mirror of
https://github.com/rfivet/uemacs.git
synced 2024-09-25 06:55:54 -04:00
$line returns a full copy of the current line instead of truncated at NSTRING.
This commit is contained in:
parent
c3f4666ff3
commit
e0550db4d1
16
line.c
16
line.c
@ -619,14 +619,24 @@ char *getctext(void)
|
|||||||
int size; /* length of line to return */
|
int size; /* length of line to return */
|
||||||
char *sp; /* string pointer into line */
|
char *sp; /* string pointer into line */
|
||||||
char *dp; /* string pointer into returned line */
|
char *dp; /* string pointer into returned line */
|
||||||
static char rline[NSTRING]; /* line to return */
|
static int rsize = 0 ;
|
||||||
|
static char *rline ; /* line to return */
|
||||||
|
|
||||||
/* find the contents of the current line and its length */
|
/* find the contents of the current line and its length */
|
||||||
lp = curwp->w_dotp;
|
lp = curwp->w_dotp;
|
||||||
sp = lp->l_text;
|
sp = lp->l_text;
|
||||||
size = lp->l_used;
|
size = lp->l_used;
|
||||||
if (size >= NSTRING)
|
if( size >= rsize) {
|
||||||
size = NSTRING - 1;
|
if( rsize)
|
||||||
|
free( rline) ;
|
||||||
|
|
||||||
|
rsize = size + 1 ;
|
||||||
|
rline = malloc( rsize) ;
|
||||||
|
if( rline == NULL) {
|
||||||
|
rsize = 0 ;
|
||||||
|
return "" ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* copy it across */
|
/* copy it across */
|
||||||
dp = rline;
|
dp = rline;
|
||||||
|
Loading…
Reference in New Issue
Block a user