[RTEMS Project] #4557: medit problem in RTEMS4.11/5.1

RTEMS trac trac at rtems.org
Thu Dec 2 14:41:23 UTC 2021


#4557: medit problem in RTEMS4.11/5.1
----------------------------+--------------------
  Reporter:  chenjin_zhong  |      Owner:  (none)
      Type:  defect         |     Status:  new
  Priority:  normal         |  Milestone:  5.1
 Component:  shell          |    Version:
  Severity:  normal         |   Keywords:
Blocked By:                 |   Blocking:
----------------------------+--------------------
 Hi, I find when open medit editor in shell console, and then input
 **CTRL+E/CTRL+X** instructions in medit.the selected text cannot be cut. I
 review the code in main_medit file. First, when I input **CTRL+E**
 instruction, the function  **select_toggle** is executed and selects the
 text. Second, when I input **CTRL+X**, the function **cut_selection**
 copies the selected text to clipboard. but after copy, the selected text
 is non-selected. Therefore, the **erase_selection** in **cut_selection**
 cannot take effect. the src code is listed as follows. I suggest that
 remove **select_toggle** in **copy_selection** function. and add after
 **copy_selection**.  the code frament is marked in bold.

 static void select_toggle(struct editor *ed) {
   ed->selecting = ed->selecting ? 0 : 1;
   update_selection(ed, ed->selecting);
   adjust(ed);
 }


 static void cut_selection(struct editor *ed) {
   copy_selection(ed);
   erase_selection(ed);
   select_toggle(ed);
 }


 static void copy_selection(struct editor *ed) {
   int selstart, selend;
   if (!get_selection(ed, &selstart, &selend)) return;
   ed->env->clipsize = selend - selstart;
   ed->env->clipboard = (unsigned char *) realloc(ed->env->clipboard,
 ed->env->clipsize);
   if (!ed->env->clipboard) return;
   copy(ed, ed->env->clipboard, selstart, ed->env->clipsize);
   select_toggle(ed);
 }

 **case ctrl('c'): copy_selection(ed); select_toggle; break;**

--
Ticket URL: <http://devel.rtems.org/ticket/4557>
RTEMS Project <http://www.rtems.org/>
RTEMS Project


More information about the bugs mailing list