Feature #939

Editorbar should dynamicaly change size depending on line numbers (linenumber ON)

Added by Zbigniew Rebacz over 9 years ago. Updated over 9 years ago.

Status:ApprovedStart date:11/26/2014
Priority:NormalDue date:
Assignee:Zbigniew Rebacz% Done:

100%

Category:CodeEditorSpent time:-
Target version:-

Description

Dynamic size of bar when line numbering is on is great feature, because we can easily support more than 9999 lines without unnecessarily wasting space. Of course our interface will be more scalable. Less lines = less bar size!

I have discovered that "EditorBar::SyncWidth()" should be implemented in following way:

void EditorBar::SyncWidth()
{
    int digits = 0;
    if (editor)
        digits = IntStr(editor->GetLineCount()).GetLength(); // <- Needs synchronization!!! (See description below)

    Width((line_numbers && editor ? editor->GetFont()['0'] * digits + 12 + 4 : 12 + 4) + annotations); // <- 4 is additional margin for annotation.
    Refresh();
}

The problem here is that SyncWidth should be invoking in different place in CodeEditor class for example putting new line or removing it or on file load. This is hard because I don't know where the file is loaded to code editor. Should we ovverride "SetData" method?

- In this task linenumbering should handle 999 999 lines or even more. It is usefull for huge files.

DynamicLineNumbers.diff Magnifier (4.05 KB) Zbigniew Rebacz, 11/30/2014 01:38 AM

DynamicLineNumbers.png (233 KB) Zbigniew Rebacz, 12/27/2014 05:08 PM

DynamicLineNumbers2.diff Magnifier - Fix for breakpoint annotation & more than 10000 lines are supported (1.01 KB) Zbigniew Rebacz, 01/07/2015 11:56 PM

History

#1 Updated by Zbigniew Rebacz over 9 years ago

  • Status changed from New to In Progress
  • Assignee set to Zbigniew Rebacz
  • % Done changed from 10 to 60

Almost done. Needs more test and checks and optimalization.

Progress:
- Editor bar now supprots up to one milion lines.
- Size of bar is dynamic and depends on number of lines.

#2 Updated by Zbigniew Rebacz over 9 years ago

  • File DynamicLineNumbers.diffMagnifier added
  • Status changed from In Progress to Patch ready
  • Assignee changed from Zbigniew Rebacz to Miroslav Fidler
  • % Done changed from 60 to 100

Implemented. Please check and review.

#3 Updated by Zbigniew Rebacz over 9 years ago

  • Status changed from Patch ready to In Progress
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz
  • % Done changed from 100 to 90

#4 Updated by Zbigniew Rebacz over 9 years ago

  • Status changed from In Progress to Patch ready
  • Assignee changed from Zbigniew Rebacz to Miroslav Fidler
  • % Done changed from 90 to 100

On clean build works well.

#5 Updated by Zbigniew Rebacz over 9 years ago

Screenshot for preprocess file.

#6 Updated by Miroslav Fidler over 9 years ago

  • Status changed from Patch ready to Approved
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

#7 Updated by Zbigniew Rebacz over 9 years ago

  • File DynamicLineNumbers2.diffMagnifier added
  • Status changed from Approved to Patch ready
  • Assignee changed from Zbigniew Rebacz to Miroslav Fidler

It cannot be approved ;), because it miss some of key features for example support for more than 10000 lines. Moreover in current implementation there is a bug with break point annotation (it overlaps the line number).

12 + 4 in code means break point annotation (sorry for the magic number).

I include diff, please review and apply.

#8 Updated by Miroslav Fidler over 9 years ago

  • Status changed from Patch ready to Ready for QA
  • Assignee changed from Miroslav Fidler to Zbigniew Rebacz

Sorry & thanks.

#9 Updated by Zbigniew Rebacz over 9 years ago

  • Status changed from Ready for QA to Approved

Also available in: Atom PDF