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

RTEMS trac trac at rtems.org
Sun Dec 5 13:34:32 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         |  Resolution:
 Keywords:                 |  Blocked By:
 Blocking:                 |
---------------------------+---------------------

Comment (by chenjin_zhong):

 Thank you! I have observed this on real hardware. then, I have checked
 https://github.com/ringgaard/sanos/tree/master/src/utils/edit. This Bug
 has been fixed. the code fragment is listed as follows. The
 erase_selection function is called by the cut_selection function and is
 able to delete selected characters.

 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);
 }

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

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


More information about the bugs mailing list