The R Project SVN R

Rev

Rev 87180 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 87180 Rev 88867
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  file console.c
3
 *  file console.c
4
 *  Copyright (C) 1998--2003  Guido Masarotto and Brian Ripley
4
 *  Copyright (C) 1998--2003  Guido Masarotto and Brian Ripley
5
 *  Copyright (C) 2004-8      The R Foundation
5
 *  Copyright (C) 2004-8      The R Foundation
6
 *  Copyright (C) 2004-2024   The R Core Team
6
 *  Copyright (C) 2004-2025   The R Core Team
7
 *
7
 *
8
 *  This program is free software; you can redistribute it and/or modify
8
 *  This program is free software; you can redistribute it and/or modify
9
 *  it under the terms of the GNU General Public License as published by
9
 *  it under the terms of the GNU General Public License as published by
10
 *  the Free Software Foundation; either version 2 of the License, or
10
 *  the Free Software Foundation; either version 2 of the License, or
11
 *  (at your option) any later version.
11
 *  (at your option) any later version.
Line 536... Line 536...
536
	l1 = wcslen(stmp);
536
	l1 = wcslen(stmp);
537
	wcsncpy(s, stmp, l1);
537
	wcsncpy(s, stmp, l1);
538
	if(l1 > l) l = l1;
538
	if(l1 > l) l = l1;
539
	s[l] = L'\0';
539
	s[l] = L'\0';
540
	len = l; /* for redraw that uses len */
540
	len = l; /* for redraw that uses len */
541
	/* and reset cursor position */
-
 
542
	{
-
 
543
	    wchar_t *P = s;
-
 
544
	    int w0;
-
 
545
	    for (w0 = 0; *P; P++) w0 += wcwidth(*P);
-
 
546
	    CURCOL = w0;
-
 
547
	}
-
 
548
    }
541
    }
549
    col1 = COLS - 1;
542
    col1 = COLS - 1;
550
    insel = p->sel ? ((i - p->my0) * (i - p->my1)) : 1;
543
    insel = p->sel ? ((i - p->my0) * (i - p->my1)) : 1;
551
    if (insel < 0) {
544
    if (insel < 0) {
552
	WLHELPER(0, col1, bg, fg);
545
	WLHELPER(0, col1, bg, fg);
Line 1822... Line 1815...
1822
    prompt_len = wcslen(aLine);
1815
    prompt_len = wcslen(aLine);
1823
    for (; P < aLine + pre_prompt_len; P++)
1816
    for (; P < aLine + pre_prompt_len; P++)
1824
	if(*P == L'\r') w0 = 0;
1817
	if(*P == L'\r') w0 = 0;
1825
	else w0 += mbcslocale ? Ri18n_wcwidth(*P) : 1;
1818
	else w0 += mbcslocale ? Ri18n_wcwidth(*P) : 1;
1826
    USER(NUMLINES - 1) = w0;
1819
    USER(NUMLINES - 1) = w0;
-
 
1820
    for(; *P; P++)
-
 
1821
	if(*P == L'\r') w0 = 0;
-
 
1822
	else w0 += mbcslocale ? Ri18n_wcwidth(*P) : 1;
1827
    prompt_wid = wcswidth(aLine);
1823
    prompt_wid = w0;
1828
    if (NUMLINES > ROWS) {
1824
    if (NUMLINES > ROWS) {
1829
	CURROW = ROWS - 1;
1825
	CURROW = ROWS - 1;
1830
	NEWFV = NUMLINES - ROWS;
1826
	NEWFV = NUMLINES - ROWS;
1831
    } else {
1827
    } else {
1832
	CURROW = NUMLINES - 1;
1828
	CURROW = NUMLINES - 1;