Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods for folding #18

Merged
merged 3 commits into from
Oct 14, 2019
Merged

Add methods for folding #18

merged 3 commits into from
Oct 14, 2019

Conversation

Kvaz1r
Copy link

@Kvaz1r Kvaz1r commented Dec 29, 2018

For code folding issue.

I opened PR in its current form because I'm not sure whether it makes sense to continue
work on this issue or to do something more needfull/simple. Of course, the main part is still ahead(binding to brackets, edit processing, nesting,...), but all this should be done on the editor's side, not the library.
This is WIP because at the library level need to add at least improve processing displaying
the scrollbar in consideration of the total number of hidden items.

ToDo

  • adapt scrollbar handling

@Kvaz1r Kvaz1r changed the title [WIP] Add methods for folding Add methods for folding Dec 30, 2018
@Kvaz1r
Copy link
Author

Kvaz1r commented Dec 30, 2018

Ok, this part is ready for review.

@@ -240,16 +242,26 @@ func (e *CodeEditor) KeyStroke(ev gxui.KeyStrokeEvent) (consume bool) {
// mixins.TextBox overrides
func (e *CodeEditor) CreateLine(theme gxui.Theme, index int) (TextBoxLine, gxui.Control) {
lineNumber := theme.CreateLabel()
lineNumber.SetText(fmt.Sprintf("%.4d", index+1)) // Displayed lines start at 1
lineNumber.SetText(fmt.Sprintf("%4d", index+1)) // Displayed lines start at 1
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to change this from %.4d to %4d?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized, the old code is bugged. In fact, vidar overrides this to get its line numbers.

lgtm.

@nelsam nelsam merged commit 6030b29 into nelsam:master Oct 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants