The R Project SVN R

Rev

Rev 79040 | Rev 83709 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 79040 Rev 82394
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
 *  Copyright (C) 1999-2020  The R Core Team
3
 *  Copyright (C) 1999-2022  The R Core Team
4
 *
4
 *
5
 *  This program is free software; you can redistribute it and/or modify
5
 *  This program is free software; you can redistribute it and/or modify
6
 *  it under the terms of the GNU General Public License as published by
6
 *  it under the terms of the GNU General Public License as published by
7
 *  the Free Software Foundation; either version 2 of the License, or
7
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  (at your option) any later version.
8
 *  (at your option) any later version.
Line 467... Line 467...
467
/*** FUNCTIONS FOR RUNNING R CODE FROM THE EDITOR ***/
467
/*** FUNCTIONS FOR RUNNING R CODE FROM THE EDITOR ***/
468
 
468
 
469
static void editorrunline(textbox t)
469
static void editorrunline(textbox t)
470
{
470
{
471
    int length = getlinelength(t); /* return character num */
471
    int length = getlinelength(t); /* return character num */
472
    char *line = malloc(length * sizeof(WCHAR) + 2); /* Extra space for null and word length in getcurrentline */
472
    /* Extra space for null and word length in getcurrentline */
-
 
473
    size_t alength = length * MB_CUR_MAX + 1 + sizeof(WORD);
-
 
474
    char *line = malloc(alength);
473
    memset(line, 0, length * sizeof(WCHAR) + 2);
475
    memset(line, 0, alength);
474
    getcurrentline(t, line, length);
476
    getcurrentline(t, line, length);
475
    consolecmd(RConsole, line);
477
    consolecmd(RConsole, line);
476
    free(line);
478
    free(line);
477
    scrollcaret(t, 1);
479
    scrollcaret(t, 1);
478
    show(t);
480
    show(t);