mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-30 03:32:53 +03:00
Use long for line numbers and columns.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
8cbea3a9a2
commit
1aa6a9574c
@ -77,7 +77,7 @@ double_marks (WEdit * edit, struct _book_mark *p)
|
||||
/** returns the first bookmark on or before this line */
|
||||
|
||||
struct _book_mark *
|
||||
book_mark_find (WEdit * edit, int line)
|
||||
book_mark_find (WEdit * edit, long line)
|
||||
{
|
||||
struct _book_mark *p;
|
||||
|
||||
@ -142,7 +142,7 @@ book_mark_find (WEdit * edit, int line)
|
||||
/** returns true if a bookmark exists at this line of color c */
|
||||
|
||||
int
|
||||
book_mark_query_color (WEdit * edit, int line, int c)
|
||||
book_mark_query_color (WEdit * edit, long line, int c)
|
||||
{
|
||||
struct _book_mark *p;
|
||||
|
||||
@ -163,7 +163,7 @@ book_mark_query_color (WEdit * edit, int line, int c)
|
||||
/** insert a bookmark at this line */
|
||||
|
||||
void
|
||||
book_mark_insert (WEdit * edit, size_t line, int c)
|
||||
book_mark_insert (WEdit * edit, long line, int c)
|
||||
{
|
||||
struct _book_mark *p, *q;
|
||||
|
||||
@ -180,10 +180,9 @@ book_mark_insert (WEdit * edit, size_t line, int c)
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
edit->force |= REDRAW_LINE;
|
||||
/* create list entry */
|
||||
q = g_malloc0 (sizeof (struct _book_mark));
|
||||
q->line = (int) line;
|
||||
q->line = line;
|
||||
q->c = c;
|
||||
q->next = p->next;
|
||||
/* insert into list */
|
||||
@ -191,6 +190,8 @@ book_mark_insert (WEdit * edit, size_t line, int c)
|
||||
if (p->next != NULL)
|
||||
p->next->prev = q;
|
||||
p->next = q;
|
||||
|
||||
edit->force |= REDRAW_LINE;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
@ -199,7 +200,7 @@ book_mark_insert (WEdit * edit, size_t line, int c)
|
||||
*/
|
||||
|
||||
int
|
||||
book_mark_clear (WEdit * edit, int line, int c)
|
||||
book_mark_clear (WEdit * edit, long line, int c)
|
||||
{
|
||||
struct _book_mark *p, *q;
|
||||
int r = 1;
|
||||
@ -269,7 +270,7 @@ book_mark_flush (WEdit * edit, int c)
|
||||
/** shift down bookmarks after this line */
|
||||
|
||||
void
|
||||
book_mark_inc (WEdit * edit, int line)
|
||||
book_mark_inc (WEdit * edit, long line)
|
||||
{
|
||||
if (edit->book_mark)
|
||||
{
|
||||
@ -284,7 +285,7 @@ book_mark_inc (WEdit * edit, int line)
|
||||
/** shift up bookmarks after this line */
|
||||
|
||||
void
|
||||
book_mark_dec (WEdit * edit, int line)
|
||||
book_mark_dec (WEdit * edit, long line)
|
||||
{
|
||||
if (edit->book_mark != NULL)
|
||||
{
|
||||
|
@ -187,18 +187,18 @@ int edit_get_byte (WEdit * edit, long byte_index);
|
||||
int edit_get_utf (WEdit * edit, long byte_index, int *char_width);
|
||||
long edit_count_lines (WEdit * edit, long current, long upto);
|
||||
long edit_move_forward (WEdit * edit, long current, long lines, long upto);
|
||||
long edit_move_forward3 (WEdit * edit, long current, int cols, long upto);
|
||||
long edit_move_forward3 (WEdit * edit, long current, long cols, long upto);
|
||||
long edit_move_backward (WEdit * edit, long current, long lines);
|
||||
void edit_scroll_screen_over_cursor (WEdit * edit);
|
||||
void edit_render_keypress (WEdit * edit);
|
||||
void edit_scroll_upward (WEdit * edit, unsigned long i);
|
||||
void edit_scroll_downward (WEdit * edit, int i);
|
||||
void edit_scroll_right (WEdit * edit, int i);
|
||||
void edit_scroll_left (WEdit * edit, int i);
|
||||
void edit_move_up (WEdit * edit, unsigned long i, int scroll);
|
||||
void edit_move_down (WEdit * edit, unsigned long i, int scroll);
|
||||
void edit_scroll_upward (WEdit * edit, long i);
|
||||
void edit_scroll_downward (WEdit * edit, long i);
|
||||
void edit_scroll_right (WEdit * edit, long i);
|
||||
void edit_scroll_left (WEdit * edit, long i);
|
||||
void edit_move_up (WEdit * edit, long i, gboolean do_scroll);
|
||||
void edit_move_down (WEdit * edit, long i, gboolean do_scroll);
|
||||
void edit_move_to_prev_col (WEdit * edit, long p);
|
||||
int edit_get_col (WEdit * edit);
|
||||
long edit_get_col (WEdit * edit);
|
||||
long edit_bol (WEdit * edit, long current);
|
||||
long edit_eol (WEdit * edit, long current);
|
||||
void edit_update_curs_row (WEdit * edit);
|
||||
@ -234,7 +234,7 @@ gboolean edit_load_cmd (WEdit * edit, edit_current_file_t what);
|
||||
void edit_mark_cmd (WEdit * edit, gboolean unmark);
|
||||
void edit_mark_current_word_cmd (WEdit * edit);
|
||||
void edit_mark_current_line_cmd (WEdit * edit);
|
||||
void edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2);
|
||||
void edit_set_markers (WEdit * edit, long m1, long m2, long c1, long c2);
|
||||
void edit_push_markers (WEdit * edit);
|
||||
void edit_replace_cmd (WEdit * edit, int again);
|
||||
void edit_search_cmd (WEdit * edit, gboolean again);
|
||||
@ -247,7 +247,8 @@ gboolean edit_save_block_cmd (WEdit * edit);
|
||||
gboolean edit_insert_file_cmd (WEdit * edit);
|
||||
void edit_insert_over (WEdit * edit);
|
||||
int edit_insert_column_of_text_from_file (WEdit * edit, int file,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2);
|
||||
long *start_pos, long *end_pos, long *col1, long *col2);
|
||||
|
||||
long edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath);
|
||||
gboolean edit_load_back_cmd (WEdit * edit);
|
||||
gboolean edit_load_forward_cmd (WEdit * edit);
|
||||
@ -289,19 +290,19 @@ void edit_load_syntax (WEdit * edit, char ***pnames, const char *type);
|
||||
void edit_free_syntax_rules (WEdit * edit);
|
||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color);
|
||||
|
||||
void book_mark_insert (WEdit * edit, size_t line, int c);
|
||||
int book_mark_query_color (WEdit * edit, int line, int c);
|
||||
int book_mark_query_all (WEdit * edit, int line, int *c);
|
||||
struct _book_mark *book_mark_find (WEdit * edit, int line);
|
||||
int book_mark_clear (WEdit * edit, int line, int c);
|
||||
void book_mark_insert (WEdit * edit, long line, int c);
|
||||
int book_mark_query_color (WEdit * edit, long line, int c);
|
||||
int book_mark_query_all (WEdit * edit, long line, int *c);
|
||||
struct _book_mark *book_mark_find (WEdit * edit, long line);
|
||||
int book_mark_clear (WEdit * edit, long line, int c);
|
||||
void book_mark_flush (WEdit * edit, int c);
|
||||
void book_mark_inc (WEdit * edit, int line);
|
||||
void book_mark_dec (WEdit * edit, int line);
|
||||
void book_mark_inc (WEdit * edit, long line);
|
||||
void book_mark_dec (WEdit * edit, long line);
|
||||
void book_mark_serialize (WEdit * edit, int color);
|
||||
void book_mark_restore (WEdit * edit, int color);
|
||||
|
||||
gboolean line_is_blank (WEdit * edit, long line);
|
||||
int edit_indent_width (WEdit * edit, long p);
|
||||
long edit_indent_width (WEdit * edit, long p);
|
||||
void edit_insert_indent (WEdit * edit, int indent);
|
||||
void edit_options_dialog (WEdit * edit);
|
||||
void edit_syntax_dialog (WEdit * edit);
|
||||
|
@ -883,10 +883,11 @@ is_blank (WEdit * edit, long offset)
|
||||
/** returns the offset of line i */
|
||||
|
||||
static long
|
||||
edit_find_line (WEdit * edit, int line)
|
||||
edit_find_line (WEdit * edit, long line)
|
||||
{
|
||||
int i, j = 0;
|
||||
int m = 2000000000;
|
||||
long i, j = 0;
|
||||
long m = 2000000000; /* what is the magic number? */
|
||||
|
||||
if (!edit->caches_valid)
|
||||
{
|
||||
for (i = 0; i < N_LINE_CACHES; i++)
|
||||
@ -905,7 +906,8 @@ edit_find_line (WEdit * edit, int line)
|
||||
/* find the closest known point */
|
||||
for (i = 0; i < N_LINE_CACHES; i++)
|
||||
{
|
||||
int n;
|
||||
long n;
|
||||
|
||||
n = abs (edit->line_numbers[i] - line);
|
||||
if (n < m)
|
||||
{
|
||||
@ -934,9 +936,10 @@ edit_find_line (WEdit * edit, int line)
|
||||
before a non-blank line is reached */
|
||||
|
||||
static void
|
||||
edit_move_up_paragraph (WEdit * edit, int do_scroll)
|
||||
edit_move_up_paragraph (WEdit * edit, gboolean do_scroll)
|
||||
{
|
||||
int i = 0;
|
||||
long i = 0;
|
||||
|
||||
if (edit->curs_line > 1)
|
||||
{
|
||||
if (line_is_blank (edit, edit->curs_line))
|
||||
@ -972,9 +975,10 @@ edit_move_up_paragraph (WEdit * edit, int do_scroll)
|
||||
before a non-blank line is reached */
|
||||
|
||||
static void
|
||||
edit_move_down_paragraph (WEdit * edit, int do_scroll)
|
||||
edit_move_down_paragraph (WEdit * edit, gboolean do_scroll)
|
||||
{
|
||||
int i;
|
||||
long i;
|
||||
|
||||
if (edit->curs_line >= edit->total_lines - 1)
|
||||
{
|
||||
i = edit->total_lines;
|
||||
@ -1264,10 +1268,10 @@ edit_left_char_move_cmd (WEdit * edit)
|
||||
*/
|
||||
|
||||
static void
|
||||
edit_move_updown (WEdit * edit, unsigned long i, int do_scroll, gboolean direction)
|
||||
edit_move_updown (WEdit * edit, long i, gboolean do_scroll, gboolean direction)
|
||||
{
|
||||
unsigned long p;
|
||||
unsigned long l = (direction) ? edit->curs_line : edit->total_lines - edit->curs_line;
|
||||
long p;
|
||||
long l = direction ? edit->curs_line : edit->total_lines - edit->curs_line;
|
||||
|
||||
if (i > l)
|
||||
i = l;
|
||||
@ -1286,7 +1290,7 @@ edit_move_updown (WEdit * edit, unsigned long i, int do_scroll, gboolean directi
|
||||
}
|
||||
p = edit_bol (edit, edit->curs1);
|
||||
|
||||
p = (direction) ? edit_move_backward (edit, p, i) : edit_move_forward (edit, p, i, 0);
|
||||
p = direction ? edit_move_backward (edit, p, i) : edit_move_forward (edit, p, i, 0);
|
||||
|
||||
edit_cursor_move (edit, p - edit->curs1);
|
||||
|
||||
@ -1617,7 +1621,7 @@ edit_double_newline (WEdit * edit)
|
||||
static void
|
||||
insert_spaces_tab (WEdit * edit, gboolean half)
|
||||
{
|
||||
int i;
|
||||
long i;
|
||||
|
||||
edit_update_curs_col (edit);
|
||||
i = option_tab_spacing * space_width;
|
||||
@ -2182,7 +2186,7 @@ edit_insert_file (WEdit * edit, const vfs_path_t * filename_vpath)
|
||||
if (vertical_insertion)
|
||||
{
|
||||
long mark1, mark2;
|
||||
int c1, c2;
|
||||
long c1, c2;
|
||||
|
||||
blocklen = edit_insert_column_of_text_from_file (edit, file, &mark1, &mark2, &c1, &c2);
|
||||
edit_set_markers (edit, edit->curs1, mark2, c1, c2);
|
||||
@ -3026,10 +3030,10 @@ edit_move_backward (WEdit * edit, long current, long lines)
|
||||
/* If upto is zero returns index of cols across from current. */
|
||||
|
||||
long
|
||||
edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
|
||||
edit_move_forward3 (WEdit * edit, long current, long cols, long upto)
|
||||
{
|
||||
long p, q;
|
||||
int col;
|
||||
long col;
|
||||
|
||||
if (upto)
|
||||
{
|
||||
@ -3096,7 +3100,7 @@ edit_move_forward3 (WEdit * edit, long current, int cols, long upto)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** returns the current column position of the cursor */
|
||||
|
||||
int
|
||||
long
|
||||
edit_get_col (WEdit * edit)
|
||||
{
|
||||
return edit_move_forward3 (edit, edit_bol (edit, edit->curs1), 0, edit->curs1);
|
||||
@ -3122,7 +3126,7 @@ edit_update_curs_col (WEdit * edit)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
long
|
||||
edit_get_curs_col (const WEdit * edit)
|
||||
{
|
||||
return edit->curs_col;
|
||||
@ -3132,12 +3136,13 @@ edit_get_curs_col (const WEdit * edit)
|
||||
/** moves the display start position up by i lines */
|
||||
|
||||
void
|
||||
edit_scroll_upward (WEdit * edit, unsigned long i)
|
||||
edit_scroll_upward (WEdit * edit, long i)
|
||||
{
|
||||
unsigned long lines_above = edit->start_line;
|
||||
long lines_above = edit->start_line;
|
||||
|
||||
if (i > lines_above)
|
||||
i = lines_above;
|
||||
if (i)
|
||||
if (i != 0)
|
||||
{
|
||||
edit->start_line -= i;
|
||||
edit->start_display = edit_move_backward (edit, edit->start_display, i);
|
||||
@ -3149,12 +3154,12 @@ edit_scroll_upward (WEdit * edit, unsigned long i)
|
||||
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
/** returns 1 if could scroll, 0 otherwise */
|
||||
|
||||
void
|
||||
edit_scroll_downward (WEdit * edit, int i)
|
||||
edit_scroll_downward (WEdit * edit, long i)
|
||||
{
|
||||
int lines_below;
|
||||
long lines_below;
|
||||
|
||||
lines_below = edit->total_lines - edit->start_line - (edit->widget.lines - 1);
|
||||
if (lines_below > 0)
|
||||
{
|
||||
@ -3171,7 +3176,7 @@ edit_scroll_downward (WEdit * edit, int i)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
edit_scroll_right (WEdit * edit, int i)
|
||||
edit_scroll_right (WEdit * edit, long i)
|
||||
{
|
||||
edit->force |= REDRAW_PAGE;
|
||||
edit->force &= (0xfff - REDRAW_CHAR_ONLY);
|
||||
@ -3181,7 +3186,7 @@ edit_scroll_right (WEdit * edit, int i)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
edit_scroll_left (WEdit * edit, int i)
|
||||
edit_scroll_left (WEdit * edit, long i)
|
||||
{
|
||||
if (edit->start_col)
|
||||
{
|
||||
@ -3200,8 +3205,8 @@ edit_scroll_left (WEdit * edit, int i)
|
||||
void
|
||||
edit_move_to_prev_col (WEdit * edit, long p)
|
||||
{
|
||||
int prev = edit->prev_col;
|
||||
int over = edit->over_col;
|
||||
long prev = edit->prev_col;
|
||||
long over = edit->over_col;
|
||||
edit_cursor_move (edit, edit_move_forward3 (edit, p, prev + edit->over_col, 0) - edit->curs1);
|
||||
|
||||
if (option_cursor_beyond_eol)
|
||||
@ -3229,6 +3234,7 @@ edit_move_to_prev_col (WEdit * edit, long p)
|
||||
{
|
||||
edit_update_curs_col (edit);
|
||||
if (space_width)
|
||||
{
|
||||
if (edit->curs_col % (HALF_TAB_SIZE * space_width))
|
||||
{
|
||||
int q = edit->curs_col;
|
||||
@ -3240,6 +3246,7 @@ edit_move_to_prev_col (WEdit * edit, long p)
|
||||
if (!left_of_four_spaces (edit))
|
||||
edit_cursor_move (edit, edit_move_forward3 (edit, p, q, 0) - edit->curs1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3298,7 +3305,7 @@ edit_push_markers (WEdit * edit)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
void
|
||||
edit_set_markers (WEdit * edit, long m1, long m2, int c1, int c2)
|
||||
edit_set_markers (WEdit * edit, long m1, long m2, long c1, long c2)
|
||||
{
|
||||
edit->mark1 = m1;
|
||||
edit->mark2 = m2;
|
||||
@ -3421,7 +3428,7 @@ edit_delete_line (WEdit * edit)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
int
|
||||
long
|
||||
edit_indent_width (WEdit * edit, long p)
|
||||
{
|
||||
long q = p;
|
||||
@ -4365,7 +4372,7 @@ edit_stack_free (void)
|
||||
/** move i lines */
|
||||
|
||||
void
|
||||
edit_move_up (WEdit * edit, unsigned long i, int do_scroll)
|
||||
edit_move_up (WEdit * edit, long i, gboolean do_scroll)
|
||||
{
|
||||
edit_move_updown (edit, i, do_scroll, TRUE);
|
||||
}
|
||||
@ -4374,7 +4381,7 @@ edit_move_up (WEdit * edit, unsigned long i, int do_scroll)
|
||||
/** move i lines */
|
||||
|
||||
void
|
||||
edit_move_down (WEdit * edit, unsigned long i, int do_scroll)
|
||||
edit_move_down (WEdit * edit, long i, gboolean do_scroll)
|
||||
{
|
||||
edit_move_updown (edit, i, do_scroll, FALSE);
|
||||
}
|
||||
|
@ -61,10 +61,10 @@ extern int show_right_margin;
|
||||
void edit_stack_init (void);
|
||||
void edit_stack_free (void);
|
||||
|
||||
gboolean edit_file (const vfs_path_t * _file_vpath, int line);
|
||||
gboolean edit_file (const vfs_path_t * _file_vpath, long line);
|
||||
|
||||
char *edit_get_file_name (const WEdit * edit);
|
||||
int edit_get_curs_col (const WEdit * edit);
|
||||
long edit_get_curs_col (const WEdit * edit);
|
||||
const char *edit_get_syntax_type (const WEdit * edit);
|
||||
|
||||
/*** inline functions ****************************************************************************/
|
||||
|
@ -2249,7 +2249,7 @@ edit_insert_over (WEdit * edit)
|
||||
|
||||
int
|
||||
edit_insert_column_of_text_from_file (WEdit * edit, int file,
|
||||
long *start_pos, long *end_pos, int *col1, int *col2)
|
||||
long *start_pos, long *end_pos, long *col1, long *col2)
|
||||
{
|
||||
long cursor;
|
||||
int col;
|
||||
@ -2600,10 +2600,10 @@ edit_replace_cmd (WEdit * edit, int again)
|
||||
|
||||
if (edit->replace_mode == 0)
|
||||
{
|
||||
int l;
|
||||
long l;
|
||||
int prompt;
|
||||
|
||||
l = edit->curs_row - edit->widget.lines / 3;
|
||||
l = (long) (edit->curs_row - edit->widget.lines / 3);
|
||||
if (l > 0)
|
||||
edit_scroll_downward (edit, l);
|
||||
if (l < 0)
|
||||
|
@ -874,8 +874,8 @@ edit_status (WEdit * edit)
|
||||
void
|
||||
edit_scroll_screen_over_cursor (WEdit * edit)
|
||||
{
|
||||
int p;
|
||||
int outby;
|
||||
long p;
|
||||
long outby;
|
||||
int b_extreme, t_extreme, l_extreme, r_extreme;
|
||||
|
||||
if (edit->widget.lines <= 0 || edit->widget.cols <= 0)
|
||||
|
@ -360,7 +360,7 @@ edit_callback (Widget * w, widget_msg_t msg, int parm)
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
gboolean
|
||||
edit_file (const vfs_path_t * _file_vpath, int line)
|
||||
edit_file (const vfs_path_t * _file_vpath, long line)
|
||||
{
|
||||
static gboolean made_directory = FALSE;
|
||||
Dlg_head *edit_dlg;
|
||||
|
@ -30,7 +30,7 @@ typedef enum
|
||||
|
||||
struct _book_mark
|
||||
{
|
||||
int line; /* line number */
|
||||
long line; /* line number */
|
||||
int c; /* color */
|
||||
struct _book_mark *next;
|
||||
struct _book_mark *prev;
|
||||
@ -70,7 +70,7 @@ struct WEdit
|
||||
|
||||
char *last_search_string; /* String that have been searched */
|
||||
long search_start; /* First character to start searching from */
|
||||
int found_len; /* Length of found string or 0 if none was found */
|
||||
unsigned long found_len; /* Length of found string or 0 if none was found */
|
||||
long found_start; /* the found word from a search - start position */
|
||||
|
||||
/* display information */
|
||||
@ -100,13 +100,13 @@ struct WEdit
|
||||
long mark1; /* position of highlight start */
|
||||
long mark2; /* position of highlight end */
|
||||
long end_mark_curs; /* position of cursor after end of highlighting */
|
||||
int column1; /* position of column highlight start */
|
||||
int column2; /* position of column highlight end */
|
||||
long column1; /* position of column highlight start */
|
||||
long column2; /* position of column highlight end */
|
||||
long bracket; /* position of a matching bracket */
|
||||
|
||||
/* cache speedup for line lookups */
|
||||
gboolean caches_valid;
|
||||
int line_numbers[N_LINE_CACHES];
|
||||
long line_numbers[N_LINE_CACHES];
|
||||
long line_offsets[N_LINE_CACHES];
|
||||
|
||||
struct _book_mark *book_mark;
|
||||
|
@ -1258,7 +1258,7 @@ edit_read_syntax_file (WEdit * edit, char ***pnames, const char *syntax_file,
|
||||
#define NENTRIES 30
|
||||
FILE *f, *g = NULL;
|
||||
char *args[1024], *l = NULL;
|
||||
int line = 0;
|
||||
long line = 0;
|
||||
int result = 0;
|
||||
int count = 0;
|
||||
char *lib_file;
|
||||
|
@ -151,7 +151,7 @@ begin_paragraph (WEdit * edit, int force)
|
||||
static long
|
||||
end_paragraph (WEdit * edit, int force)
|
||||
{
|
||||
int i;
|
||||
long i;
|
||||
for (i = edit->curs_line + 1; i <= edit->total_lines; i++)
|
||||
{
|
||||
if (line_is_blank (edit, i))
|
||||
|
Loading…
x
Reference in New Issue
Block a user