Skip to content
Snippets Groups Projects
Commit 005c699b authored by Rene Brun's avatar Rene Brun
Browse files

From Bertrand Bellenot/Valeriy Onuchin

The problem:
    multiple pressing of arrow key changes console cursor position.
    But cursor became visible only at last position.

 This mods made by Bertrand fixed the problem.


git-svn-id: http://root.cern.ch/svn/root/trunk@8051 27541ba8-7e3a-0410-8455-c3a389f83636
parent fdddca8f
No related branches found
No related tags found
No related merge requests found
/* @(#)root/clib:$Name: $:$Id: Getline.c,v 1.15 2004/01/19 10:49:13 rdm Exp $ */
/* @(#)root/clib:$Name: $:$Id: Getline.c,v 1.16 2004/01/19 15:23:42 rdm Exp $ */
/* Author: */
/*
......@@ -772,6 +772,9 @@ Gl_windowchanged()
char *
Getlinem(int mode, const char *prompt)
{
#ifdef WIN32
CONSOLE_SCREEN_BUFFER_INFO ci;
#endif
int c, loc, tmp;
int sig;
......@@ -853,7 +856,21 @@ Getlinem(int mode, const char *prompt)
break;
case '\001': gl_fixup(gl_prompt, -1, 0); /* ^A */
break;
case '\002': gl_fixup(gl_prompt, -1, gl_pos-1); /* ^B */
case '\002': /* ^B */
#ifndef WIN32 // bb
gl_fixup(gl_prompt, -1, gl_pos-1);
#else
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &ci);
if (gl_pos-1 < 0) {
gl_putc('\007');
gl_pos = 0;
break;
}
ci.dwCursorPosition.X -= 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), ci.dwCursorPosition );
gl_pos = gl_pos-1;
#endif
break;
case '\004': /* ^D */
if (gl_cnt == 0) {
......@@ -867,7 +884,21 @@ Getlinem(int mode, const char *prompt)
break;
case '\005': gl_fixup(gl_prompt, -1, gl_cnt); /* ^E */
break;
case '\006': gl_fixup(gl_prompt, -1, gl_pos+1); /* ^F */
case '\006': /* ^F */
#ifndef WIN32 // bb
gl_fixup(gl_prompt, -1, gl_pos+1);
#else
GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &ci);
if (gl_pos+1 > gl_cnt) {
if (gl_pos != BUF_SIZE) /* BUF_SIZE means end of line */
gl_putc('\007');
gl_pos = gl_cnt;
break;
}
ci.dwCursorPosition.X += 1;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), ci.dwCursorPosition );
gl_pos = gl_pos+1;
#endif
break;
case '\010': case '\177': gl_del(-1); /* ^H and DEL */
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment