Introduction
Introduction Statistics Contact Development Disclaimer Help
tFix compilation on Linux - ledit - Text editor (WIP)
git clone git://lumidify.org/ledit.git (fast, but not encrypted)
git clone https://lumidify.org/git/ledit.git (encrypted, but very slow)
Log
Files
Refs
README
LICENSE
---
commit a52f6845ba83e6df5d60d22844b1a2546ca97af1
parent b3a32dd52672a8a385308afb73198d129294c7c3
Author: lumidify <[email protected]>
Date: Thu, 11 Nov 2021 18:48:56 +0100
Fix compilation on Linux
Diffstat:
M keys_basic.c | 3 +--
M ledit.c | 17 ++++++++++++++---
2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/keys_basic.c b/keys_basic.c
t@@ -1655,7 +1655,7 @@ join_lines(ledit_buffer *buffer, char *text, int len) {
if (num == 0)
num = 1;
int start_group = 1;
- ledit_line *ll1, *ll2;
+ ledit_line *ll1;
int cur_line = buffer->cur_line;
/* FIXME: have a general tmp buf for everyone to use */
txtbuf *buf = txtbuf_new();
t@@ -1670,7 +1670,6 @@ join_lines(ledit_buffer *buffer, char *text, int len) {
are stored later */
ll1 = ledit_buffer_get_line(buffer, cur_line);
oldlen = ll1->len;
- ll2 = ledit_buffer_get_line(buffer, cur_line + 1);
/* FIXME: truncate whitespace to one space */
ledit_buffer_delete_range(
buffer, 0,
diff --git a/ledit.c b/ledit.c
t@@ -65,6 +65,17 @@ ledit_common common;
int cur_lang = 0;
struct action cur_action = {ACTION_NONE, NULL};
+/* stolen from OpenBSD */
+#define ledit_timespecsub(tsp, usp, vsp) …
+ do { \
+ (vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec; \
+ (vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec; \
+ if ((vsp)->tv_nsec < 0) { \
+ (vsp)->tv_sec--; \
+ (vsp)->tv_nsec += 1000000000L; \
+ } \
+ } while (0)
+
static void
mainloop(void) {
XEvent event;
t@@ -174,7 +185,7 @@ mainloop(void) {
};
if (last_motion_valid) {
clock_gettime(CLOCK_MONOTONIC, &now);
- timespecsub(&now, &last_motion, &elapsed);
+ ledit_timespecsub(&now, &last_motion, &elapsed);
if (elapsed.tv_sec > 0 || elapsed.tv_nsec >= MOUSE_TIC…
need_redraw |= drag_motion(&last_motion_event);
last_motion = now;
t@@ -183,7 +194,7 @@ mainloop(void) {
}
if (last_scroll_valid) {
clock_gettime(CLOCK_MONOTONIC, &now);
- timespecsub(&now, &last_scroll, &elapsed);
+ ledit_timespecsub(&now, &last_scroll, &elapsed);
if (elapsed.tv_sec > 0 || elapsed.tv_nsec >= MOUSE_TIC…
need_redraw |= button_press(&last_scroll_event…
last_scroll = now;
t@@ -211,7 +222,7 @@ mainloop(void) {
}
clock_gettime(CLOCK_MONOTONIC, &now);
- timespecsub(&now, &last, &elapsed);
+ ledit_timespecsub(&now, &last, &elapsed);
if (elapsed.tv_sec == 0 && elapsed.tv_nsec < TICK) {
sleep_time.tv_nsec = TICK - elapsed.tv_nsec;
nanosleep(&sleep_time, NULL);
You are viewing proxied material from lumidify.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.