Ver código fonte

Code refactor

master
Arun Prakash Jana 6 anos atrás
pai
commit
bd653ac91e
Nenhuma chave conhecida encontrada para esta assinatura no banco de dados ID da chave GPG: A75979F35C080412
2 arquivos alterados com 5 adições e 6 exclusões
  1. +1
    -1
      Makefile
  2. +4
    -5
      src/nnn.c

+ 1
- 1
Makefile Ver arquivo

@@ -18,7 +18,7 @@ else
LDLIBS_CURSES ?= -lncurses LDLIBS_CURSES ?= -lncurses
endif endif


CFLAGS += -Wall -Wextra -Wno-unused-parameter CFLAGS += -Wall -Wextra -Wno-unused-parameter -Wno-format-truncation
CFLAGS += $(CFLAGS_OPTIMIZATION) CFLAGS += $(CFLAGS_OPTIMIZATION)
CFLAGS += $(CFLAGS_CURSES) CFLAGS += $(CFLAGS_CURSES)




+ 4
- 5
src/nnn.c Ver arquivo

@@ -2019,7 +2019,7 @@ static char *coolsize(off_t size)
{ {
static const char * const U = "BKMGTPEZY"; static const char * const U = "BKMGTPEZY";
static char size_buf[12]; /* Buffer to hold human readable size */ static char size_buf[12]; /* Buffer to hold human readable size */
static off_t rem; off_t rem;
int i; int i;


rem = i = 0; rem = i = 0;
@@ -2067,9 +2067,9 @@ static char *coolsize(off_t size)
} }


if (i > 0 && i < 6) if (i > 0 && i < 6)
snprintf(size_buf, 12, "%lu.%0*lu%c", (ulong)size, i, (ulong)rem, U[i]); snprintf(size_buf, 12, "%lu.%0*lu%c", size, i, rem, U[i]);
else else
snprintf(size_buf, 12, "%lu%c", (ulong)size, U[i]); snprintf(size_buf, 12, "%lu%c", size, U[i]);


return size_buf; return size_buf;
} }
@@ -3158,7 +3158,7 @@ nochange:
// Handle clicking on a file: // Handle clicking on a file:
if (2 <= event.y && event.y < xlines - 2) { if (2 <= event.y && event.y < xlines - 2) {
// Get index of the first file listed on-screen: // Get index of the first file listed on-screen:
r = MAX(0, MIN(cur-((xlines-4)>>1), ndents-(xlines-4))); r = MAX(0, MIN(cur - ((xlines - 4) >> 1), ndents - (xlines - 4)));
// Add the mouse click position to get the clicked file: // Add the mouse click position to get the clicked file:
r += event.y - 2; r += event.y - 2;


@@ -3170,7 +3170,6 @@ nochange:
// Single click just selects, double click also opens // Single click just selects, double click also opens
if (event.bstate != BUTTON1_DOUBLE_CLICKED) if (event.bstate != BUTTON1_DOUBLE_CLICKED)
break; break;
// fallthrough to select the file
} else } else
goto nochange; // fallthrough goto nochange; // fallthrough
case SEL_NAV_IN: // fallthrough case SEL_NAV_IN: // fallthrough


||||||
x
 
000:0
Carregando…
Cancelar
Salvar