1
1

Set fullscreen layout as previous editor look'n'feel.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
Andrew Borodin 2012-06-03 16:54:15 +04:00
родитель efb7f073cc
Коммит bf1924e7ff
5 изменённых файлов: 339 добавлений и 229 удалений

Просмотреть файл

@ -33,7 +33,6 @@
#define EDIT_TEXT_HORIZONTAL_OFFSET 0
#define EDIT_TEXT_VERTICAL_OFFSET 0
#define EDIT_WITH_FRAME 1
#define EDIT_RIGHT_EXTREME option_edit_right_extreme
#define EDIT_LEFT_EXTREME option_edit_left_extreme
@ -168,6 +167,9 @@ extern int option_edit_bottom_extreme;
extern const char *option_whole_chars_search;
extern gboolean search_create_bookmark;
extern char *edit_window_state_char;
extern char *edit_window_close_char;
/*** declarations of public functions ************************************************************/
gboolean edit_add_window (Dlg_head * h, int y, int x, int lines, int cols,
@ -258,8 +260,7 @@ void edit_show_numbers_cmd (Dlg_head * h);
void edit_date_cmd (WEdit * edit);
void edit_goto_cmd (WEdit * edit);
int eval_marks (WEdit * edit, long *start_mark, long *end_mark);
void edit_info_status (WEdit * edit);
void edit_status (WEdit * edit);
void edit_status (WEdit * edit, gboolean active);
void edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_insertion);
void edit_update_screen (WEdit * edit);
void edit_save_size (WEdit * edit);

Просмотреть файл

@ -3451,7 +3451,7 @@ edit_execute_key_command (WEdit * edit, unsigned long command, int char_for_inse
void
edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion)
{
if (EDIT_WITH_FRAME && command == CK_WindowFullscreen)
if (command == CK_WindowFullscreen)
{
edit_toggle_fullscreen (edit);
return;

Просмотреть файл

@ -372,8 +372,8 @@ editcmd_dialog_completion_show (WEdit * edit, int max_len, int word_len,
compl_dlg_h = num_compl + 2;
compl_dlg_w = max_len + 4;
start_x = edit->curs_col + edit->start_col - (compl_dlg_w / 2) +
EDIT_TEXT_HORIZONTAL_OFFSET + EDIT_WITH_FRAME + option_line_state_width;
start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + EDIT_WITH_FRAME + 1;
EDIT_TEXT_HORIZONTAL_OFFSET + (edit->fullscreen ? 0 : 1) + option_line_state_width;
start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + (edit->fullscreen ? 0 : 1) + 1;
if (start_x < 0)
start_x = 0;
@ -461,8 +461,8 @@ editcmd_dialog_select_definition_show (WEdit * edit, char *match_expr, int max_l
def_dlg_h = num_lines + 2;
def_dlg_w = max_len + 4;
start_x = edit->curs_col + edit->start_col - (def_dlg_w / 2) +
EDIT_TEXT_HORIZONTAL_OFFSET + EDIT_WITH_FRAME + option_line_state_width;
start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + EDIT_WITH_FRAME + 1;
EDIT_TEXT_HORIZONTAL_OFFSET + (edit->fullscreen ? 0 : 1) + option_line_state_width;
start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + (edit->fullscreen ? 0 : 1) + 1;
if (start_x < 0)
start_x = 0;

Просмотреть файл

@ -2,11 +2,12 @@
Editor text drawing.
Copyright (C) 1996, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006,
2007, 2011
2007, 2011, 2012
The Free Software Foundation, Inc.
Written by:
Paul Sheer, 1996, 1997
Andrew Borodin <aborodin@vmail.ru> 2012
This file is part of the Midnight Commander.
@ -90,6 +91,14 @@ struct line_s
/*** file scope variables ************************************************************************/
/*** file scope functions ************************************************************************/
static inline void
printwstr (const char *s, int len)
{
if (len > 0)
tty_printf ("%-*.*s", len, len, s);
}
/* --------------------------------------------------------------------------------------------- */
static inline void
@ -176,12 +185,198 @@ status_string (WEdit * edit, char *s, int w)
}
/* --------------------------------------------------------------------------------------------- */
/**
* Draw the status line at the top of the screen for fullscreen editor window.
*
* @param edit editor object
* @param color color pair
*/
static inline void
printwstr (const char *s, int len)
edit_status_fullscreen (WEdit * edit, int color)
{
if (len > 0)
tty_printf ("%-*.*s", len, len, s);
const int w = edit->widget.owner->cols;
const size_t status_size = w + 1;
char *const status = g_malloc (status_size);
int status_len;
const char *fname = "";
int fname_len;
const int gap = 3; /* between the filename and the status */
const int right_gap = 5; /* at the right end of the screen */
const int preferred_fname_len = 16;
status_string (edit, status, status_size);
status_len = (int) str_term_width1 (status);
if (edit->filename_vpath != NULL)
fname = x_basename (vfs_path_get_last_path_str (edit->filename_vpath));
fname_len = str_term_width1 (fname);
if (fname_len < preferred_fname_len)
fname_len = preferred_fname_len;
if (fname_len + gap + status_len + right_gap >= w)
{
if (preferred_fname_len + gap + status_len + right_gap >= w)
fname_len = preferred_fname_len;
else
fname_len = w - (gap + status_len + right_gap);
fname = str_trunc (fname, fname_len);
}
dlg_move (edit->widget.owner, 0, 0);
tty_setcolor (color);
printwstr (fname, fname_len + gap);
printwstr (status, w - (fname_len + gap));
if (simple_statusbar && w > EDITOR_MINIMUM_TERMINAL_WIDTH)
{
size_t percent = 100;
if (edit->total_lines + 1 != 0)
percent = (edit->curs_line + 1) * 100 / (edit->total_lines + 1);
dlg_move (edit->widget.owner, 0, w - 6 - 6);
tty_printf (" %3d%%", percent);
}
g_free (status);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Draw status line for editor window if window is not in fullscreen mode.
*
* @param edit editor object
*/
static inline void
edit_status_window (WEdit * edit)
{
int y, x;
int cols = edit->widget.cols;
tty_setcolor (STATUSBAR_COLOR);
if (cols > 5)
{
const char *fname = N_("NoName");
char *full_fname = NULL;
if (edit->filename_vpath != NULL)
{
full_fname = vfs_path_to_str (edit->filename_vpath);
fname = x_basename (full_fname);
}
#ifdef ENABLE_NLS
else
fname = _(fname);
#endif
edit_move (2, 0);
tty_printf ("[%s]", str_term_trim (fname, edit->widget.cols - 8 - 6));
g_free (full_fname);
}
tty_getyx (&y, &x);
x -= edit->widget.x;
x += 4;
if (x + 6 <= cols - 2 - 6)
{
edit_move (x, 0);
tty_printf ("[%c%c%c%c]",
edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
edit->modified ? 'M' : '-',
macro_index < 0 ? '-' : 'R', edit->overwrite == 0 ? '-' : 'O');
}
if (cols > 30)
{
edit_move (2, edit->widget.lines - 1);
tty_printf ("%3ld %5ld/%ld %6ld/%ld",
edit->curs_col + edit->over_col,
edit->curs_line + 1, edit->total_lines + 1, edit->curs1, edit->last_byte);
}
/*
* If we are at the end of file, print <EOF>,
* otherwise print the current character as is (if printable),
* as decimal and as hex.
*/
if (cols > 46)
{
edit_move (32, edit->widget.lines - 1);
if (edit->curs1 >= edit->last_byte)
tty_print_string ("[<EOF> ]");
#ifdef HAVE_CHARSET
else if (edit->utf8)
{
unsigned int cur_utf;
int cw = 1;
cur_utf = edit_get_utf (edit, edit->curs1, &cw);
if (cw <= 0)
cur_utf = edit_get_byte (edit, edit->curs1);
tty_printf ("[%05d 0x%04X]", cur_utf, cur_utf);
}
#endif
else
{
unsigned char cur_byte;
cur_byte = edit_get_byte (edit, edit->curs1);
tty_printf ("[%05d 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte);
}
}
}
/* --------------------------------------------------------------------------------------------- */
/**
* Draw a frame around edit area.
*
* @param edit editor object
* @param color color pair
* @param active TRUE if editor object is focused
*/
static inline void
edit_draw_frame (const WEdit * edit, int color, gboolean active)
{
const Widget *w = (const Widget *) edit;
/* draw a frame around edit area */
tty_setcolor (color);
/* draw double frame for active window if skin supports that */
tty_draw_box (w->y, w->x, w->lines, w->cols, !active);
/* draw a drag marker */
if (edit->drag_state == MCEDIT_DRAG_NORMAL)
{
tty_setcolor (EDITOR_FRAME_DRAG);
widget_move (w, w->lines - 1, w->cols - 1);
tty_print_alt_char (ACS_LRCORNER, TRUE);
}
}
/* --------------------------------------------------------------------------------------------- */
/**
* Draw a window control buttons.
*
* @param edit editor object
* @param color color pair
*/
static inline void
edit_draw_window_icons (const WEdit * edit, int color)
{
const Widget *w = (const Widget *) edit;
char tmp[17];
tty_setcolor (color);
if (edit->fullscreen)
dlg_move (w->owner, 0, w->owner->cols - 6);
else
widget_move (w, 0, edit->widget.cols - 8);
g_snprintf (tmp, sizeof (tmp), "[%s][%s]", edit_window_state_char, edit_window_close_char);
tty_print_string (tmp);
}
/* --------------------------------------------------------------------------------------------- */
@ -194,14 +389,17 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
int x = start_col_real;
int x1 = start_col + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
int y = row + EDIT_TEXT_VERTICAL_OFFSET + EDIT_WITH_FRAME;
int y = row + EDIT_TEXT_VERTICAL_OFFSET;
int cols_to_skip = abs (x);
int i;
int wrap_start;
int len;
if (EDIT_WITH_FRAME && !edit->fullscreen)
if (!edit->fullscreen)
{
x1++;
y++;
}
tty_setcolor (EDITOR_NORMAL_COLOR);
if (bookmarked != 0)
@ -317,7 +515,7 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
int book_mark = 0;
char line_stat[LINE_STATE_WIDTH + 1] = "\0";
if (row > edit->widget.lines - 1 - EDIT_TEXT_VERTICAL_OFFSET - 2 * EDIT_WITH_FRAME)
if (row > edit->widget.lines - 1 - EDIT_TEXT_VERTICAL_OFFSET - 2 * (edit->fullscreen ? 0 : 1))
return;
if (book_mark_query_color (edit, edit->start_line + row, BOOK_MARK_COLOR))
@ -331,7 +529,7 @@ edit_draw_this_line (WEdit * edit, long b, long row, long start_col, long end_co
abn_style = MOD_ABNORMAL;
end_col -= EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
if (EDIT_WITH_FRAME && !edit->fullscreen)
if (!edit->fullscreen)
{
const Widget *w = (const Widget *) edit;
@ -823,143 +1021,25 @@ edit_render (WEdit * edit, int page, int row_start, int col_start, int row_end,
/*** public functions ****************************************************************************/
/* --------------------------------------------------------------------------------------------- */
/** Draw the status line at the top of the screen. The size of the filename
* field varies depending on the width of the screen and the length of
* the filename. */
void
edit_status (WEdit * edit)
edit_status (WEdit * edit, gboolean active)
{
const int w = edit->widget.owner->cols;
const size_t status_size = w + 1;
char *const status = g_malloc (status_size);
int status_len;
const char *fname = "";
int fname_len;
const int gap = 3; /* between the filename and the status */
const int right_gap = 5; /* at the right end of the screen */
const int preferred_fname_len = 16;
int color;
status_string (edit, status, status_size);
status_len = (int) str_term_width1 (status);
if (edit->filename_vpath != NULL)
fname = vfs_path_get_last_path_str (edit->filename_vpath);
fname_len = str_term_width1 (fname);
if (fname_len < preferred_fname_len)
fname_len = preferred_fname_len;
if (fname_len + gap + status_len + right_gap >= w)
if (edit->fullscreen)
{
if (preferred_fname_len + gap + status_len + right_gap >= w)
fname_len = preferred_fname_len;
else
fname_len = w - (gap + status_len + right_gap);
fname = str_trunc (fname, fname_len);
color = STATUSBAR_COLOR;
edit_status_fullscreen (edit, color);
}
else
{
color = edit->drag_state != MCEDIT_DRAG_NORMAL ? EDITOR_FRAME_DRAG : active ?
EDITOR_FRAME_ACTIVE : EDITOR_FRAME;
edit_draw_frame (edit, color, active);
edit_status_window (edit);
}
dlg_move (edit->widget.owner, 0, 0);
tty_setcolor (STATUSBAR_COLOR);
printwstr (fname, fname_len + gap);
printwstr (status, w - (fname_len + gap));
if (simple_statusbar && w > EDITOR_MINIMUM_TERMINAL_WIDTH)
{
size_t percent = 100;
if (edit->total_lines + 1 != 0)
percent = (edit->curs_line + 1) * 100 / (edit->total_lines + 1);
dlg_move (edit->widget.owner, 0, w - 5);
tty_printf (" %3d%%", percent);
}
g_free (status);
}
/* --------------------------------------------------------------------------------------------- */
void
edit_info_status (WEdit * edit)
{
int y, x;
int cols = edit->widget.cols;
tty_setcolor (STATUSBAR_COLOR);
if (cols > 5)
{
const char *fname = N_("NoName");
char *full_fname = NULL;
if (edit->filename_vpath != NULL)
{
full_fname = vfs_path_to_str (edit->filename_vpath);
fname = x_basename (full_fname);
}
#ifdef ENABLE_NLS
else
fname = _(fname);
#endif
edit_move (edit->fullscreen ? 0 : 2, 0);
tty_printf ("[%s]", str_term_trim (fname, edit->widget.cols - 8 - 6));
g_free (full_fname);
}
tty_getyx (&y, &x);
x -= edit->widget.x;
x += 4;
if (x + 6 <= cols - (edit->fullscreen ? 0 : 2) - 6)
{
edit_move (x, 0);
tty_printf ("[%c%c%c%c]",
edit->mark1 != edit->mark2 ? (edit->column_highlight ? 'C' : 'B') : '-',
edit->modified ? 'M' : '-',
macro_index < 0 ? '-' : 'R',
edit->overwrite == 0 ? '-' : 'O');
}
if (cols > 30)
{
edit_move (2, edit->widget.lines - 1);
tty_printf ("%3ld %5ld/%ld %6ld/%ld",
edit->curs_col + edit->over_col,
edit->curs_line + 1,
edit->total_lines + 1,
edit->curs1,
edit->last_byte );
}
/*
* If we are at the end of file, print <EOF>,
* otherwise print the current character as is (if printable),
* as decimal and as hex.
*/
if (cols > 46)
{
edit_move (32, edit->widget.lines - 1);
if (edit->curs1 >= edit->last_byte)
tty_print_string ("[<EOF> ]");
#ifdef HAVE_CHARSET
else if (edit->utf8)
{
unsigned int cur_utf;
int cw = 1;
cur_utf = edit_get_utf (edit, edit->curs1, &cw);
if (cw <= 0)
cur_utf = edit_get_byte (edit, edit->curs1);
tty_printf ("[%05d 0x%04X]", cur_utf, cur_utf);
}
#endif
else
{
unsigned char cur_byte;
cur_byte = edit_get_byte (edit, edit->curs1);
tty_printf ("[%05d 0x%04X]", (unsigned int) cur_byte, (unsigned int) cur_byte);
}
}
edit_draw_window_icons (edit, color);
}
/* --------------------------------------------------------------------------------------------- */
@ -975,13 +1055,15 @@ edit_scroll_screen_over_cursor (WEdit * edit)
if (edit->widget.lines <= 0 || edit->widget.cols <= 0)
return;
edit->widget.y += EDIT_WITH_FRAME;
edit->widget.lines -= EDIT_TEXT_VERTICAL_OFFSET + 2 * EDIT_WITH_FRAME;
edit->widget.lines -= EDIT_TEXT_VERTICAL_OFFSET;
edit->widget.cols -= EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
if (EDIT_WITH_FRAME && !edit->fullscreen)
if (!edit->fullscreen)
{
edit->widget.x++;
edit->widget.cols -= 2;
edit->widget.y++;
edit->widget.lines -= 2;
}
r_extreme = EDIT_RIGHT_EXTREME;
@ -1030,13 +1112,14 @@ edit_scroll_screen_over_cursor (WEdit * edit)
edit_scroll_upward (edit, outby);
edit_update_curs_row (edit);
edit->widget.y -= EDIT_WITH_FRAME;
edit->widget.lines += EDIT_TEXT_VERTICAL_OFFSET + 2 * EDIT_WITH_FRAME;
edit->widget.lines += EDIT_TEXT_VERTICAL_OFFSET;
edit->widget.cols += EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width;
if (EDIT_WITH_FRAME && !edit->fullscreen)
if (!edit->fullscreen)
{
edit->widget.x--;
edit->widget.cols += 2;
edit->widget.y--;
edit->widget.lines += 2;
}
}

Просмотреть файл

@ -66,6 +66,9 @@
/*** global variables ****************************************************************************/
char *edit_window_state_char = NULL;
char *edit_window_close_char = NULL;
/*** file scope macro definitions ****************************************************************/
#define WINDOW_MIN_LINES (2 + 2)
@ -74,9 +77,6 @@
/*** file scope type declarations ****************************************************************/
/*** file scope variables ************************************************************************/
static char *edit_window_state_char = NULL;
static char *edit_window_close_char = NULL;
static unsigned int edit_dlg_init_refcounter = 0;
/*** file scope functions ************************************************************************/
@ -185,53 +185,6 @@ edit_help (void)
mc_event_raise (MCEVENT_GROUP_CORE, "help", &event_data);
}
/* --------------------------------------------------------------------------------------------- */
static void
edit_draw_frame (const WEdit * edit, gboolean active)
{
const Widget *w = (const Widget *) edit;
int dx;
char tmp[17];
int color;
color = edit->drag_state != MCEDIT_DRAG_NORMAL ? EDITOR_FRAME_DRAG : active ?
EDITOR_FRAME_ACTIVE : EDITOR_FRAME;
if (edit->fullscreen)
{
tty_setcolor (active ? EDITOR_FRAME_ACTIVE : EDITOR_FRAME);
/* draw lines at top and bottom */
/* draw double lines for active window if skin supports that */
tty_draw_hline (w->y, w->x, mc_tty_frm[!active ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ],
w->cols);
tty_draw_hline (w->y + w->lines - 1, w->x,
mc_tty_frm[!active ? MC_TTY_FRM_HORIZ : MC_TTY_FRM_DHORIZ], w->cols);
dx = 6;
}
else
{
/* draw a frame around edit area */
tty_setcolor (color);
/* draw double frame for active window if skin supports that */
tty_draw_box (w->y, w->x, w->lines, w->cols, !active);
/* draw a drag marker */
if (edit->drag_state == MCEDIT_DRAG_NORMAL)
{
tty_setcolor (EDITOR_FRAME_DRAG);
widget_move (w, w->lines - 1, w->cols - 1);
tty_print_alt_char (ACS_LRCORNER, TRUE);
}
dx = 8;
}
/* toggle fullscreen mode and close icons */
tty_setcolor (color);
widget_move (w, 0, edit->widget.cols - dx);
g_snprintf (tmp, sizeof (tmp), "[%s][%s]", edit_window_state_char, edit_window_close_char);
tty_print_string (tmp);
}
/* --------------------------------------------------------------------------------------------- */
/**
* Callback for the iteration of objects in the 'editors' array.
@ -354,6 +307,12 @@ edit_window_resize (WEdit * edit, unsigned long command)
}
/* --------------------------------------------------------------------------------------------- */
/**
* Get hotkey by number.
*
* @param n number
* @return hotkey
*/
static unsigned char
get_hotkey (int n)
@ -454,6 +413,13 @@ edit_get_title (const Dlg_head * h, size_t len)
}
/* --------------------------------------------------------------------------------------------- */
/**
* Handle mouse events of editor window
*
* @param event mouse event
* @param data editor window
* @return MOU_NORMAL if event was handled, MOU_UNHANDLED otherwise
*/
static int
edit_event (Gpm_Event * event, void *data)
@ -476,7 +442,7 @@ edit_event (Gpm_Event * event, void *data)
edit_update_curs_row (edit);
edit_update_curs_col (edit);
if (!EDIT_WITH_FRAME || (local.buttons & GPM_B_LEFT) == 0 || (local.type & GPM_UP) != 0)
if (edit->fullscreen || (local.buttons & GPM_B_LEFT) == 0 || (local.type & GPM_UP) != 0)
edit->drag_state = MCEDIT_DRAG_NORMAL;
else if (local.y == 1 && edit->drag_state != MCEDIT_DRAG_RESIZE)
{
@ -590,7 +556,7 @@ edit_event (Gpm_Event * event, void *data)
}
}
if (EDIT_WITH_FRAME)
if (!edit->fullscreen)
local.y--;
if (local.y > (edit->curs_row + 1))
edit_move_down (edit, local.y - (edit->curs_row + 1), 0);
@ -616,7 +582,7 @@ edit_event (Gpm_Event * event, void *data)
edit_update_curs_col (edit);
edit_update_screen (edit);
}
while (EDIT_WITH_FRAME && !done);
while (!edit->fullscreen && !done);
}
else
while (edit->drag_state != MCEDIT_DRAG_NORMAL)
@ -685,6 +651,78 @@ edit_event (Gpm_Event * event, void *data)
return MOU_NORMAL;
}
/* --------------------------------------------------------------------------------------------- */
/**
* Handle mouse events of editor screen.
*
* @param event mouse event
* @param data editor screen
* @return MOU_NORMAL if event was handled, MOU_UNHANDLED otherwise
*/
static int
edit_dialog_event (Gpm_Event *event, void *data)
{
Dlg_head *h = (Dlg_head *) data;
Widget *w;
int ret = MOU_UNHANDLED;
w = (Widget *) find_menubar (h);
if (event->y == h->y + 1 && (event->type & GPM_DOWN) != 0 && !((WMenuBar *) w)->is_active)
{
/* menubar */
GList *l;
GList *top = NULL;
int x;
/* Try find top fullscreen window */
for (l = h->widgets; l != NULL; l = g_list_next (l))
if (edit_widget_is_editor ((Widget *) l->data) && ((WEdit *) l->data)->fullscreen)
top = l;
/* Handle fullscreen/close buttons in the top line */
x = h->x + h->cols + 1 - 6;
if (top != NULL && event->x >= x)
{
WEdit *e;
e = (WEdit *) top->data;
x = event->x - x;
if (top != h->current)
{
/* Window is not active. Activate it */
dlg_set_top_widget (e);
}
/* Handle buttons */
if (x <= 2)
edit_toggle_fullscreen (e);
else
edit_dialog_callback (h, NULL, DLG_ACTION, CK_Close, NULL);
ret = MOU_NORMAL;
}
if (ret == MOU_UNHANDLED)
dlg_select_widget (w);
}
else if (event->y == h->y + h->lines)
{
/* buttonbar */
/* In general, this can be handled in default way (dlg_mouse_event)
* but let make it here to avoid walking in widget list */
w = (Widget *) find_buttonbar (h);
ret = w->mouse (event, w);
}
return ret;
}
/* --------------------------------------------------------------------------------------------- */
static cb_ret_t
@ -956,12 +994,8 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
return MSG_HANDLED;
case WIDGET_UNFOCUS:
if (!EDIT_WITH_FRAME)
return MSG_NOT_HANDLED;
/* redraw frame and status */
edit_draw_frame (e, FALSE);
edit_info_status (e);
edit_status (e, FALSE);
return MSG_HANDLED;
case WIDGET_KEY:
@ -993,12 +1027,13 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
case WIDGET_CURSOR:
{
int x = (EDIT_WITH_FRAME && !e->fullscreen) ? 1 : 0;
int y, x;
x += e->curs_col + e->start_col + e->over_col + EDIT_TEXT_HORIZONTAL_OFFSET +
option_line_state_width;
y = (e->fullscreen ? 0 : 1) + EDIT_TEXT_VERTICAL_OFFSET + e->curs_row;
x = (e->fullscreen ? 0 : 1) + EDIT_TEXT_HORIZONTAL_OFFSET + option_line_state_width +
e->curs_col + e->start_col + e->over_col;
widget_move (w, e->curs_row + EDIT_TEXT_VERTICAL_OFFSET + EDIT_WITH_FRAME, x);
widget_move (w, y, x);
return MSG_HANDLED;
}
@ -1065,7 +1100,7 @@ edit_files (const GList *files)
/* Create a new dialog and add it widgets to it */
edit_dlg =
create_dlg (FALSE, 0, 0, LINES, COLS, NULL, edit_dialog_callback, NULL,
create_dlg (FALSE, 0, 0, LINES, COLS, NULL, edit_dialog_callback, edit_dialog_event,
"[Internal File Editor]", NULL, DLG_WANT_TAB);
edit_dlg->get_shortcut = edit_get_shortcut;
@ -1138,15 +1173,8 @@ edit_update_screen (WEdit * e)
edit_scroll_screen_over_cursor (e);
edit_update_curs_col (e);
if (!EDIT_WITH_FRAME)
edit_status (e);
else
{
if ((e->force & REDRAW_COMPLETELY) != 0)
edit_draw_frame (e, (void *) e == ((Widget *) e)->owner->current->data);
edit_info_status (e);
}
edit_status (e, (e->force & REDRAW_COMPLETELY) != 0 &&
(void *) e == ((Widget *) e)->owner->current->data);
/* pop all events for this window for internal handling */
if (!is_idle ())
@ -1272,8 +1300,7 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
case CK_WindowMove:
edit->drag_state = MCEDIT_DRAG_NORMAL;
/* redraw frame and status */
edit_draw_frame (edit, TRUE);
edit_info_status (edit);
edit_status (edit, TRUE);
default:
ret = TRUE;
break;
@ -1298,8 +1325,7 @@ edit_handle_move_resize (WEdit * edit, unsigned long command)
case CK_WindowResize:
edit->drag_state = MCEDIT_DRAG_NORMAL;
/* redraw frame and status */
edit_draw_frame (edit, TRUE);
edit_info_status (edit);
edit_status (edit, TRUE);
default:
ret = TRUE;
break;