Author Topic: fix page-left command  (Read 397 times)

flethuseo

  • Senior Community Member
  • Posts: 177
  • Hero Points: 2
fix page-left command
« on: July 17, 2015, 06:31:38 pm »
Here's a specific improvement fix, I'd like to see "fix page-left command". I use this command often when scrolling through large tables and when I try to back-track it advances way more to the left than it should be:

_command void page_left() name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   int width;
   if (p_object!=OI_LIST_BOX && p_fixed_font) {
      width=(p_char_width intdiv 2)*p_font_width;
   } else {
      width=p_client_width intdiv 2;
   }
   int cursor_x=p_cursor_x;
   int left_edge=p_left_edge-width;
   if ( left_edge<0 ) {
      cursor_x=cursor_x-width;
   }
   if (left_edge<0) left_edge=0;
   p_cursor_x=0;
   set_scroll_pos(left_edge,p_cursor_y);
   p_cursor_x=cursor_x;
   /*
   if (p_object!=OI_LIST_BOX && p_fixed_font) {
      ix=(cursor_x-_adjusted_windent_x()) intdiv p_font_width;
      p_cursor_x=_adjusted_windent_x()+(ix)*p_font_width;
      //say('h2 cursor_x='cursor_x' c='p_cursor_x);
   } else {
      p_cursor_x=cursor_x;
   }
   */
}


Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4794
  • Hero Points: 388
Re: fix page-left command
« Reply #1 on: July 17, 2015, 07:47:07 pm »
Here's a specific improvement fix, I'd like to see "fix page-left command". I use this command often when scrolling through large tables and when I try to back-track it advances way more to the left than it should be:

_command void page_left() name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   int width;
   if (p_object!=OI_LIST_BOX && p_fixed_font) {
      width=(p_char_width intdiv 2)*p_font_width;
   } else {
      width=p_client_width intdiv 2;
   }
   int cursor_x=p_cursor_x;
   int left_edge=p_left_edge-width;
   if ( left_edge<0 ) {
      cursor_x=cursor_x-width;
   }
   if (left_edge<0) left_edge=0;
   p_cursor_x=0;
   set_scroll_pos(left_edge,p_cursor_y);
   p_cursor_x=cursor_x;
   /*
   if (p_object!=OI_LIST_BOX && p_fixed_font) {
      ix=(cursor_x-_adjusted_windent_x()) intdiv p_font_width;
      p_cursor_x=_adjusted_windent_x()+(ix)*p_font_width;
      //say('h2 cursor_x='cursor_x' c='p_cursor_x);
   } else {
      p_cursor_x=cursor_x;
   }
   */
}

This is a bug. Thanks for posting this. A new thread would be better for a bug report. Problem seems to be with fixed font files. This will be fixed in v20. I've posted a fix below.

Code: [Select]
_command void page_left() name_info(','VSARG2_REQUIRES_EDITORCTL|VSARG2_READ_ONLY)
{
   int width;
   if (p_fixed_font) {
      width=(p_char_width intdiv 2);
   } else {
      width=p_client_width intdiv 2;
   }
   int cursor_x=p_cursor_x;
   int left_edge=p_left_edge-width;
   if ( left_edge<0 ) {
      cursor_x=cursor_x-width;
   }
   if (left_edge<0) left_edge=0;
   p_cursor_x=0;
   set_scroll_pos(left_edge,p_cursor_y);
   p_cursor_x=cursor_x;
   /*
   if (p_object!=OI_LIST_BOX && p_fixed_font) {
      ix=(cursor_x-_adjusted_windent_x()) intdiv p_font_width;
      p_cursor_x=_adjusted_windent_x()+(ix)*p_font_width;
      //say('h2 cursor_x='cursor_x' c='p_cursor_x);
   } else {
      p_cursor_x=cursor_x;
   }
   */
}