-
Notifications
You must be signed in to change notification settings - Fork 220
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
Fix for #1151 - Add line numbers and current line marker to secondary prompt #1152
base: master
Are you sure you want to change the base?
Conversation
…-AND-CURRENT-LINE SQLCL-4749 support line numbering and current line
@gnodet Here is a first pass as one of our fixes. @Eraoui909 has prepped this from the first change we want. |
Does the |
Hey @gnodet |
Actually, @Eraoui909 the |
…-AND-CURRENT-LINE Sqlcl 4749 support line numbering and current line
Hey @gnodet, Screen.Recording.2025-01-14.at.10.22.15.PM.mov |
@@ -4176,6 +4177,16 @@ private AttributedString expandPromptPattern(String pattern, int padToWidth, Str | |||
case 'N': | |||
sb.append(getInt(LINE_OFFSET, 0) + line); | |||
break decode; | |||
case 'C': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this new C
option ? it seems to me that setting LINE_OFFSET
to 1
would achieve the same ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C
option used to handle this pattern %5P %C%*
for numbering the new secondary prompt lines
sb.append(getInt(LINE_OFFSET, 0) + (line + 1)); | ||
break decode; | ||
case '*': | ||
if (getCurrentLineNo(this.currentLines) == line) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The currentLine
should be computed once and passed as an argument to this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can do this because, in a secondary prompt, the number of lines may change with each new user input. Therefore, I need to ensure that I always get the updated number of lines.
@@ -4277,6 +4303,7 @@ private AttributedString insertSecondaryPrompts( | |||
buf.setLength(0); | |||
} | |||
int line = 0; | |||
this.currentLines = lines; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we compute the currentLine easier, maybe we can store only that information instead of the list of lines ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I'll compute directly the currentLine.
Thanks!
This PR aims to add line numbering to the secondary prompt, and the current edit line will also be marked with an asterisk (*).
This is the behavior before the change:
before.mov
And this is the new behavior:
after.mov