Commit Graph

32 Commits

Author SHA1 Message Date
Christian Göttsche 53732ab0bb Resolve -Wimplicit-int-conversion warnings
Panel.c:414:49: error: implicit conversion loses integer precision: 'int' to 'short' [-Werror,-Wimplicit-int-conversion]
      this->scrollH = MAXIMUM(this->selectedLen - this->w, 0);
                    ~         ~~~~~~~~~~~~~~~~~~^~~~~~~~~
./Macros.h:11:54: note: expanded from macro 'MAXIMUM'
#define MAXIMUM(a, b)                  ((a) > (b) ? (a) : (b))
                                                     ^

IncSet.c:159:38: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         mode->buffer[mode->index] = ch;
                                   ~ ^~

Panel.c:456:24: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         buffer[len] = ch;
                     ~ ^~
Panel.c:473:22: error: implicit conversion loses integer precision: 'int' to 'char' [-Werror,-Wimplicit-int-conversion]
         buffer[0] = ch;
                   ~ ^~
2021-10-01 18:36:35 +02:00
Daniel Lange 94ad111391 Update license headers to explicitly say GPLv2+ 2021-09-22 14:28:19 +02:00
Christian Göttsche d72b0a682e Mark several non-modified pointer variables const 2021-01-11 20:12:34 +01:00
Christian Göttsche 958112c5a3 Refactor setting filter and use safe strncpy 2021-01-11 20:12:34 +01:00
Christian Göttsche 7ff654f2df Drop useless double parenthesis 2021-01-06 16:42:54 +01:00
Christian Göttsche badeaf9e82 IncSet: do not resize on our own and do not search on resize
The supervising ScreenManager will resize all Panels.
Also do not start the search on resize.
2021-01-04 23:12:43 +01:00
Daniel Lange 8b83a9f055 Enable going back to previous search matches (Shift-F3) 2020-12-25 11:53:02 +01:00
Jake Mannens f46ddd3230 Remove 'n' and 'N' search inc/dec keybinds 2020-12-24 03:24:15 +11:00
Christian Göttsche e3862aa67e Rework drawing of FunctionBar
Draw the FunctionBar within Panel_draw instead of manually throughout
the code.
Add an optional PanelClass function drawFunctionBar, to allow specific
panels to override the default FunctionBar_draw call.
Rework the code on color change, to really change all colors (selection
markers and panel headers).

Closes: #402
2020-12-20 17:01:50 +01:00
Christian Göttsche 7e7a53c415 Mark event arrays const 2020-12-20 16:58:37 +01:00
Benny Baumann 45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
Benny Baumann b23f8235e2 Whitespace and indentation issues 2020-11-02 22:15:01 +01:00
Benny Baumann adf797c295 Spacing after keywords (for) 2020-11-02 22:15:01 +01:00
Benny Baumann 0f5262917f Make all required includes explicit
Information as seen by IWYU 0.12 + clang 9 on Linux
2020-10-18 20:09:05 +02:00
Benny Baumann 872e542f4e Rename StringUtils.[ch] to XUtils.[ch] 2020-10-16 20:30:21 +02:00
Christian Göttsche b47bc667a2 Add key to pause process list updates 2020-10-12 13:04:00 +02:00
Daniel Lange 079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Christian Göttsche 8a849bc85a Call character checking function with unsigned char
See https://wiki.sei.cmu.edu/confluence/display/c/STR37-C.+Arguments+to+character-handling+functions+must+be+representable+as+an+unsigned+char
2020-09-17 22:03:24 +02:00
Hugo Musso Gualandi 9207401f97 Clean up some code duplication in the header files
PR htop-dev/htop#70 got rid of the infrastructure for generating header
files, but it left behind some code duplication.

Some of cases are things that belong in the header file and don't need
to be repeated in the C file. Other cases are things that belong in the
C file and don't need to be in the header file.

In this commit I tried to fix all of these that I could find. When given
a choice I preferred keeping things out of the header file, unless they
were being used by someone else.
2020-09-12 19:20:44 -03:00
Zev Weiss a1a027b9bd Axe automated header generation.
Reasoning:
 - implementation was unsound -- broke down when I added a fairly
   basic macro definition expanding to a struct initializer in a *.c
   file.

 - made it way too easy (e.g. via otherwise totally innocuous git
   commands) to end up with timestamps such that it always ran
   MakeHeader.py but never used its output, leading to overbuild noise
   when running what should be a null 'make'.

 - but mostly: it's just an awkward way of dealing with C code.
2020-09-03 11:58:58 -05:00
syrrim 8d7afb33e2 added MainPanel actions n and N for find next and find prev. closes #601 2018-11-03 15:59:55 -04:00
Richard d5faf64374 Mark some things as const
Several string pointer arrays pointed to const strings
but were not const themselves.

A few various structures and arrays were also marked const.
2017-07-22 22:34:30 -05:00
Hisham 572546f806 Auto-follow process after a search.
See #237.
2016-05-05 10:30:06 -03:00
Hisham b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Antoine Catton 065aab5247 Redraw the panel when resizing the window during an incremental search
KEY_RESIZE wasn't handled by the incremental search. Resulting in this
bug:

  * Set your terminal window to a small size.
  * Press '\' to filter the processes
  * Maximize your terminal window
  * The list of processes didn't resize.

This change fixes this bug.

Thank you Julian Andrews (@julianandrews) for finding this bug.
2015-12-09 23:46:25 -07:00
David Hunt 5e602f18d5 Rename String to StringUtils.
Fixes building on case-insensitive filesystems where String.h gets confused with <string.h>.

From d734dacea0a10d0465dad4e95b3421511e7da112 Mon Sep 17 00:00:00 2001
From: David Hunt <dhunt@iolanthe.attlocal.net>
Date: Sat, 11 Jul 2015 20:56:31 -0500
Subject: [PATCH 1/8] Rename String to StringUtils
2015-08-19 13:45:20 -03:00
Hisham Muhammad 54f8d8154b Do not trust isalpha(c) for values > 255.
Fixes #174.

Conflicts:
	Panel.c
2015-03-23 18:14:35 -03:00
Hisham Muhammad ade7993fcb incremental search and filter reintegrated! 2015-03-23 17:04:53 -03:00
Hisham Muhammad d0c72c3fb2 Move FunctionBar inside Panel 2015-03-23 15:26:56 -03:00
Hisham Muhammad 616ee966d7 Fix out-of-bounds write. 2014-04-24 19:48:34 -03:00
Hisham Muhammad 76a715ee8c Fix order of calloc arguments.
(Patch by Dawid Gajownik)
2014-01-16 18:51:16 -02:00
Hisham Muhammad 2a73405cd0 search and filter for the strace and lsof screens! 2012-11-10 00:31:37 +00:00