Skip to content

ISQL will truncate lines longer than 255 when pasting #8524

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

Open
afarias-br opened this issue Apr 15, 2025 · 5 comments · May be fixed by #8561
Open

ISQL will truncate lines longer than 255 when pasting #8524

afarias-br opened this issue Apr 15, 2025 · 5 comments · May be fixed by #8561
Assignees

Comments

@afarias-br
Copy link

Firebird 5 ISQL will truncate lines longer than 255 when pasting (tested on Windows 10)

  1. Open command prompt
  2. Execute ISQL connecting to a database, i.e. isql server:dbpath
  3. Open a script file in any text editor, select all and copy
  4. Paste it back to ISQL prompt

If any script line has more than 255 chars, it will be truncated and script execution will fail. Attached example script.

Same script will run fine if you paste into Firebird 2.5 ISQL.

sp_test_long_line.txt

@hvlad hvlad self-assigned this May 8, 2025
@hvlad hvlad added the type: bug label May 8, 2025
@hvlad
Copy link
Member

hvlad commented May 9, 2025

The issue was introduced by the fix for #7202. The problem is that when using ReadConsoleW() it is not possible to enter more than MAX(254, buffer_size) chars before the EOL - console just not accepts chars that not fit into buffer. Its the same for paste from clipboard or manually typing.
This is not documented limitation but I found no other explanations of what I see. Thus I want to ask - what maximum 'single line' length is acceptable ? Note, this is not a limit on the length of a whole pasted text, this is about length of every single line.

@aafemt
Copy link
Contributor

aafemt commented May 9, 2025

Perhaps you cannot go beyond 8191 characters so it looks like a reasonable limit.

@hvlad
Copy link
Member

hvlad commented May 9, 2025

You refers to the command prompt (cmd.exe) limitation, it is not about console in general.
Actually, I'm able to paste into (patched) isql text greater than 10K characters. One line, of course.

While I agree, that such cases is not what really happens, and even 1024 chars per line is more than enough usually,
I want to be sure that we will not be asked to enlarge limit again and again.

Currently, I use buffer of 32K characters for ReadConsoleW() and consider it as big enough.

@mrotteveel
Copy link
Member

Have you tried with ReadFile instead of ReadConsole? The documentation suggests they should work similarly on a console handle.

@hvlad
Copy link
Member

hvlad commented May 9, 2025

https://learn.microsoft.com/en-us/windows/console/readconsole :

ReadConsole reads keyboard input from a console's input buffer. It behaves like the ReadFile function, except that it can read in either Unicode (wide-character) or ANSI mode. To have applications that maintain a single set of sources compatible with both modes, use ReadConsole rather than ReadFile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants