RectangleSelection up to 150-200 lines slow
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- csharp
- Ambito
- desktop, performance
Direzione di ricerca
Inizia da Selection.SetEndpoint in ICSharpCode.AvalonEdit.Editing e riproduci il rallentamento con 1.000 righe usando Alt, Shift e Down; esamina come viene chiamato CalculateSegments per le selezioni rettangolari. Il lavoro è completato quando la selezione rimane coerente con il comportamento esistente evitando al contempo il rallentamento progressivo intorno alle 150–200 righe.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
hi, sorry for english but i use a translator. i tried for two days to speed up the management of the rectangular selection but without success, you can replicate the problem as follows: paste a text of 1000 lines, press and hold ALT and also hold down shift and the down arrow, to create a rectangular selection, go down until the program slows down around the 150-200 line. I tracked down the source of the problem and it is this:
public override Selection SetEndpoint(TextViewPosition endPosition)
in ICSharpCode.AvalonEdit.Editing
basically as it is designed every time you go down a line it calls
void CalculateSegments()
for all the lines
this means that at the 10th line the calculation it will do will be 10 lines, at the 150th line it will have to recalculate 150 lines, so the more you go down the slower the selection becomes, I tried with the following code to change the individual segments of the selection with excellent results in terms of speed but terrible in terms of consistency with everything else, is there any way to do it?
void CalculateSegmentsExists(TextViewPosition endPosition, int previousEndLine)
{
for (int i = 0; i < segments.Count; i++) {
SelectionSegment item = segments[i];
DocumentLine myLine = textArea.Document.GetLineByOffset(item.EndOffset);
int NewVC = endPosition.VisualColumn - item.EndVisualColumn;
TextViewPosition textViewPosition = new TextViewPosition(myLine.LineNumber, endPosition.VisualColumn);
if (myLine.Length < textViewPosition.Location.Column) {
NewVC = 0;
}
segments[i] = new SelectionSegment(item.StartOffset, item.StartVisualColumn, item.EndOffset + NewVC, endPosition.VisualColumn);
}
if (endPosition.Line > previousEndLine) {
for (int i = previousEndLine + 1; i <= endPosition.Line; i++) {
VisualLine vl = textArea.TextView.GetOrConstructVisualLine(nextLine);
int startVC = vl.GetVisualColumn(new Point(startXPos, 0), true);
int endVC = vl.GetVisualColumn(new Point(endXPos, 0), true);
int baseOffset = vl.FirstDocumentLine.Offset;
int startOffset = baseOffset + vl.GetRelativeOffset(startVC);
int endOffset = baseOffset + vl.GetRelativeOffset(endVC);
segments.Add(new SelectionSegment(startOffset, startVC, endOffset, endVC));
}
}
}
what I thought is: instead of recreating the rectangular selection every time if there was a way to do some sort of update maybe it would be faster, the problem is that I'm faced with too many things that remain unaligned
- Lingua principale
- C#
- Stelle
- 2.1k
- Fork
- 496
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di icsharpcode/AvalonEdit
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 76/100
icsharpcode/AvalonEdit#454 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
icsharpcode/AvalonEdit#449 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 48/100
icsharpcode/AvalonEdit#446 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 28/100
icsharpcode/AvalonEdit#445 · 1 commento ·
-
Context menu ApplicationCommands.Cut still enabled when IsReadOnly = trueForse già presa @JyslaFancy l’ha presa 162 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
icsharpcode/AvalonEdit#444 ·
Tutte le issue di icsharpcode/AvalonEdit
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
umbraco/Umbraco.Automate#612 ·
I maintainer di solito rispondono entro 1 giorno
-
崩溃日志只按 CRLF 分行Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PCL-Community/PCL-CE#3872 ·
I maintainer di solito rispondono entro 1 giorno
-
type:task ux
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
elsa-workflows/elsa-foundation#5253 ·
I maintainer di solito rispondono entro 1 giorno