mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
* *.c: Removed trailing whitespace.
This commit is contained in:
parent
6916fd28a2
commit
05d2881a71
@ -1,3 +1,7 @@
|
||||
2005-02-07 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* *.c: Removed trailing whitespace.
|
||||
|
||||
2005-02-07 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* edit.h: Removed catstrs, as it is only used in editcmd.c.
|
||||
|
22
edit/edit.c
22
edit/edit.c
@ -1,14 +1,14 @@
|
||||
/* editor low level data handling and cursor fundamentals.
|
||||
|
||||
Copyright (C) 1996, 1997 the Free Software Foundation
|
||||
|
||||
|
||||
Authors: 1996, 1997 Paul Sheer
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ -60,9 +60,9 @@ char *option_backup_ext = "~";
|
||||
/*
|
||||
*
|
||||
* here's a quick sketch of the layout: (don't run this through indent.)
|
||||
*
|
||||
*
|
||||
* (b1 is buffers1 and b2 is buffers2)
|
||||
*
|
||||
*
|
||||
* |
|
||||
* \0\0\0\0\0m e _ f i l e . \nf i n . \n|T h i s _ i s _ s o\0\0\0\0\0\0\0\0\0
|
||||
* ______________________________________|______________________________________
|
||||
@ -79,7 +79,7 @@ char *option_backup_ext = "~";
|
||||
* file end|||file beginning
|
||||
* |
|
||||
* |
|
||||
*
|
||||
*
|
||||
* _
|
||||
* This_is_some_file
|
||||
* fin.
|
||||
@ -491,7 +491,7 @@ edit_init (WEdit *edit, int lines, int columns, const char *filename,
|
||||
|
||||
if (!edit) {
|
||||
#ifdef ENABLE_NLS
|
||||
/*
|
||||
/*
|
||||
* Expand option_whole_chars_search by national letters using
|
||||
* current locale
|
||||
*/
|
||||
@ -570,7 +570,7 @@ edit_clean (WEdit *edit)
|
||||
/* a stale lock, remove it */
|
||||
if (edit->locked)
|
||||
edit->locked = edit_unlock_file (edit->filename);
|
||||
|
||||
|
||||
/* save cursor position */
|
||||
if (option_save_position)
|
||||
edit_save_position (edit);
|
||||
@ -807,7 +807,7 @@ static inline void edit_modification (WEdit * edit)
|
||||
{
|
||||
edit->caches_valid = 0;
|
||||
edit->screen_modified = 1;
|
||||
|
||||
|
||||
/* raise lock when file modified */
|
||||
if (!edit->modified && !edit->delete_file)
|
||||
edit->locked = edit_lock_file (edit->filename);
|
||||
@ -837,7 +837,7 @@ edit_insert (WEdit *edit, int c)
|
||||
if (edit->loading_done) {
|
||||
edit_modification (edit);
|
||||
}
|
||||
|
||||
|
||||
/* now we must update some info on the file and check if a redraw is required */
|
||||
if (c == '\n') {
|
||||
if (edit->book_mark)
|
||||
@ -1451,7 +1451,7 @@ int line_is_blank (WEdit * edit, long line)
|
||||
return is_blank (edit, edit_find_line (edit, line));
|
||||
}
|
||||
|
||||
/* moves up until a blank line is reached, or until just
|
||||
/* moves up until a blank line is reached, or until just
|
||||
before a non-blank line is reached */
|
||||
static void edit_move_up_paragraph (WEdit * edit, int scroll)
|
||||
{
|
||||
@ -1958,7 +1958,7 @@ static void edit_tab_cmd (WEdit * edit)
|
||||
if (option_fake_half_tabs) {
|
||||
if (is_in_indent (edit)) {
|
||||
/*insert a half tab (usually four spaces) unless there is a
|
||||
half tab already behind, then delete it and insert a
|
||||
half tab already behind, then delete it and insert a
|
||||
full tab. */
|
||||
if (!option_fill_tabs_with_spaces && right_of_four_spaces (edit)) {
|
||||
for (i = 1; i <= HALF_TAB_SIZE; i++)
|
||||
|
@ -253,7 +253,7 @@ edit_save_file (WEdit *edit, const char *filename)
|
||||
if (!savename)
|
||||
return 0;
|
||||
/* FIXME:
|
||||
* Close for now because mc_mkstemps use pure open system call
|
||||
* Close for now because mc_mkstemps use pure open system call
|
||||
* to create temporary file and it needs to be reopened by
|
||||
* VFS-aware mc_open().
|
||||
*/
|
||||
@ -405,7 +405,7 @@ void menu_save_mode_cmd (void)
|
||||
/* OK/Cancel buttons */
|
||||
l1 = strlen (_(widgets[0].text)) + strlen (_(widgets[1].text)) + 5;
|
||||
maxlen = max (maxlen, l1);
|
||||
|
||||
|
||||
for (i = 0; i < 3; i++ ) {
|
||||
str[i] = _(str[i]);
|
||||
maxlen = max (maxlen, strlen (str[i]) + 7);
|
||||
@ -495,7 +495,7 @@ edit_save_as_cmd (WEdit *edit)
|
||||
if (!edit->locked && !edit->delete_file)
|
||||
save_lock = edit_lock_file (exp);
|
||||
}
|
||||
|
||||
|
||||
if (edit_save_file (edit, exp)) {
|
||||
/* Succesful, so unlock both files */
|
||||
if (strcmp (edit->filename, exp)) {
|
||||
@ -507,7 +507,7 @@ edit_save_as_cmd (WEdit *edit)
|
||||
if (edit->locked || save_lock)
|
||||
edit->locked = edit_unlock_file (edit->filename);
|
||||
}
|
||||
|
||||
|
||||
edit_set_filename (edit, exp);
|
||||
g_free (exp);
|
||||
edit->modified = 0;
|
||||
@ -551,7 +551,7 @@ raw_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
|
||||
}
|
||||
|
||||
/* gets a raw key from the keyboard. Passing cancel = 1 draws
|
||||
a cancel button thus allowing c-c etc. Alternatively, cancel = 0
|
||||
a cancel button thus allowing c-c etc. Alternatively, cancel = 0
|
||||
will return the next key pressed. ctrl-a (=B_CANCEL), ctrl-g, ctrl-c,
|
||||
and Esc are cannot returned */
|
||||
int
|
||||
@ -779,17 +779,17 @@ static int
|
||||
edit_save_cmd (WEdit *edit)
|
||||
{
|
||||
int res, save_lock = 0;
|
||||
|
||||
|
||||
if (!edit->locked && !edit->delete_file)
|
||||
save_lock = edit_lock_file (edit->filename);
|
||||
res = edit_save_file (edit, edit->filename);
|
||||
|
||||
|
||||
/* Maintain modify (not save) lock on failure */
|
||||
if ((res && edit->locked) || save_lock)
|
||||
edit->locked = edit_unlock_file (edit->filename);
|
||||
|
||||
|
||||
/* On failure try 'save as', it does locking on its own */
|
||||
if (!res)
|
||||
if (!res)
|
||||
return edit_save_as_cmd (edit);
|
||||
edit->force |= REDRAW_COMPLETELY;
|
||||
edit->delete_file = 0;
|
||||
@ -821,7 +821,7 @@ edit_load_file_from_filename (WEdit * edit, char *exp)
|
||||
{
|
||||
int prev_locked = edit->locked;
|
||||
char *prev_filename = g_strdup (edit->filename);
|
||||
|
||||
|
||||
if (!edit_reload (edit, exp)) {
|
||||
g_free (prev_filename);
|
||||
return 1;
|
||||
@ -1492,7 +1492,7 @@ edit_find_string (long start, unsigned char *exp, int *len, long last_byte, edit
|
||||
}
|
||||
} else { /* regexp matching */
|
||||
long offset = 0;
|
||||
int found_start, match_bol, move_win = 0;
|
||||
int found_start, match_bol, move_win = 0;
|
||||
|
||||
while (start + offset < last_byte) {
|
||||
match_bol = (offset == 0 || (*get_byte) (data, start + offset - 1) == '\n');
|
||||
@ -2380,7 +2380,7 @@ int edit_sort_cmd (WEdit * edit)
|
||||
|
||||
exp = old ? old : "";
|
||||
|
||||
exp = input_dialog (_(" Run Sort "),
|
||||
exp = input_dialog (_(" Run Sort "),
|
||||
_(" Enter sort options (see manpage) separated by whitespace: "), exp);
|
||||
|
||||
if (!exp)
|
||||
@ -2391,12 +2391,12 @@ int edit_sort_cmd (WEdit * edit)
|
||||
e = system (catstrs (" sort ", exp, " ", home_dir, BLOCK_FILE, " > ", home_dir, TEMP_FILE, (char *) NULL));
|
||||
if (e) {
|
||||
if (e == -1 || e == 127) {
|
||||
edit_error_dialog (_(" Sort "),
|
||||
edit_error_dialog (_(" Sort "),
|
||||
get_sys_error (_(" Cannot execute sort command ")));
|
||||
} else {
|
||||
char q[8];
|
||||
sprintf (q, "%d ", e);
|
||||
edit_error_dialog (_(" Sort "),
|
||||
edit_error_dialog (_(" Sort "),
|
||||
catstrs (_(" Sort returned non-zero: "), q, (char *) NULL));
|
||||
}
|
||||
return -1;
|
||||
@ -2650,7 +2650,7 @@ void edit_mail_dialog (WEdit * edit)
|
||||
static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len)
|
||||
{
|
||||
int i, c, last;
|
||||
|
||||
|
||||
/* return if at begin of file */
|
||||
if (edit->curs1 <= 0)
|
||||
return 0;
|
||||
@ -2658,14 +2658,14 @@ static int edit_find_word_start (WEdit *edit, long *word_start, int *word_len)
|
||||
c = (unsigned char) edit_get_byte (edit, edit->curs1 - 1);
|
||||
/* return if not at end or in word */
|
||||
if (isspace (c) || !(isalnum (c) || c == '_'))
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
/* search start of word to be completed */
|
||||
for (i = 2;; i++) {
|
||||
/* return if at begin of file */
|
||||
if (edit->curs1 - i < 0)
|
||||
if (edit->curs1 - i < 0)
|
||||
return 0;
|
||||
|
||||
|
||||
last = c;
|
||||
c = (unsigned char) edit_get_byte (edit, edit->curs1 - i);
|
||||
|
||||
|
@ -80,7 +80,7 @@ static void status_string (WEdit * edit, char *s, int w)
|
||||
edit->total_lines + 1,
|
||||
|
||||
edit->curs1,
|
||||
edit->last_byte,
|
||||
edit->last_byte,
|
||||
byte_str);
|
||||
}
|
||||
|
||||
@ -471,7 +471,7 @@ edit_render (WEdit * edit, int page, int row_start, int col_start, int row_end,
|
||||
redraw_labels (edit->widget.parent);
|
||||
render_edit_text (edit, row_start, col_start, row_end, col_end);
|
||||
/*
|
||||
* edit->force != 0 means a key was pending and the redraw
|
||||
* edit->force != 0 means a key was pending and the redraw
|
||||
* was halted, so next time we must redraw everything in case stuff
|
||||
* was left undrawn from a previous key press.
|
||||
*/
|
||||
|
@ -1,14 +1,14 @@
|
||||
/* Editor key translation.
|
||||
|
||||
Copyright (C) 1996, 1997 the Free Software Foundation
|
||||
|
||||
|
||||
Authors: 1996, 1997 Paul Sheer
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
@ -269,7 +269,7 @@ edit_translate_key (WEdit *edit, long x_key, int *cmd, int *ch)
|
||||
}
|
||||
|
||||
/* Function still not found for this key, so try macros */
|
||||
/* This allows the same macro to be
|
||||
/* This allows the same macro to be
|
||||
enabled by either eg "ALT('f')" or "XCTRL('f')" or "XCTRL('a'), 'f'" */
|
||||
|
||||
if (x_key & ALT (0)) { /* is an alt key ? */
|
||||
|
@ -114,7 +114,7 @@ lock_get_info (const char *lockfname)
|
||||
|
||||
|
||||
/* Tries to raise file lock
|
||||
Returns 1 on success, 0 on failure, -1 if abort
|
||||
Returns 1 on success, 0 on failure, -1 if abort
|
||||
Warning: Might do screen refresh and lose edit->force */
|
||||
int
|
||||
edit_lock_file (const char *fname)
|
||||
@ -179,7 +179,7 @@ edit_lock_file (const char *fname)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Lowers file lock if possible
|
||||
/* Lowers file lock if possible
|
||||
Always returns 0 to make 'lock = edit_unlock_file (f)' possible */
|
||||
int
|
||||
edit_unlock_file (const char *fname)
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
#undef edit_message_dialog
|
||||
#define edit_message_dialog(w,x,y,h,s) query_dialog (h, s, 0, 1, _("&OK"))
|
||||
#define CFocus(x)
|
||||
#define CFocus(x)
|
||||
|
||||
static void
|
||||
menu_cmd (int command)
|
||||
@ -207,7 +207,7 @@ menu_sort_cmd (void)
|
||||
menu_cmd (CK_Sort);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
menu_ext_cmd (void)
|
||||
{
|
||||
menu_cmd (CK_ExtCmd);
|
||||
|
@ -444,7 +444,7 @@ static void translate_rule_to_color (WEdit * edit, struct syntax_rule rule, int
|
||||
|
||||
void edit_get_syntax_color (WEdit * edit, long byte_index, int *color)
|
||||
{
|
||||
if (edit->rules && byte_index < edit->last_byte &&
|
||||
if (edit->rules && byte_index < edit->last_byte &&
|
||||
option_syntax_highlighting && use_colors) {
|
||||
translate_rule_to_color (edit, edit_get_rule (edit, byte_index), color);
|
||||
} else {
|
||||
@ -577,7 +577,7 @@ static int get_args (char *l, char **args, int args_size)
|
||||
args[argc++] = convert (p);
|
||||
}
|
||||
args[argc] = (char *) NULL;
|
||||
return argc;
|
||||
return argc;
|
||||
}
|
||||
|
||||
#define free_args(x)
|
||||
|
@ -148,8 +148,8 @@ static void strip_newlines (unsigned char *t, int size)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
This is a copy of the function
|
||||
/*
|
||||
This is a copy of the function
|
||||
int calc_text_pos (WEdit * edit, long b, long *q, int l)
|
||||
in propfont.c :(
|
||||
It calculates the number of chars in a line specified to length l in pixels
|
||||
@ -238,8 +238,8 @@ static void format_this (unsigned char *t, int size, int indent)
|
||||
break;
|
||||
p = word_start (t, q, size);
|
||||
if (p == -1)
|
||||
q = next_word_start (t, q, size); /* Return the end of the word if the beginning
|
||||
of the word is at the beginning of a line
|
||||
q = next_word_start (t, q, size); /* Return the end of the word if the beginning
|
||||
of the word is at the beginning of a line
|
||||
(i.e. a very long word) */
|
||||
else
|
||||
q = p;
|
||||
|
Loading…
Reference in New Issue
Block a user