+#include "tweak.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include "tweak.h"
-
static void act_exit (void);
static void act_save (void);
static void act_exitsave (void);
return NULL;
}
-static int begline(int x) {
- int y = x + width-offset;
+static fileoffset_t begline(fileoffset_t x) {
+ fileoffset_t y = x + width-offset;
y -= (y % width);
y -= width-offset;
if (y < 0)
return y;
}
-static int endline(int x) {
- int y = x + width-offset;
+static fileoffset_t endline(fileoffset_t x) {
+ fileoffset_t y = x + width-offset;
y -= (y % width);
y += width-1;
y -= width-offset;
}
static void act_right(void) {
- int new_top;
+ fileoffset_t new_top;
if (edit_type == 1) {
if (cur_pos < file_size)
}
static void act_end(void) {
- int new_top;
+ fileoffset_t new_top;
cur_pos = endline(cur_pos);
edit_type = !!edit_type;
}
static void act_down(void) {
- int new_top;
+ fileoffset_t new_top;
cur_pos += width;
if (cur_pos >= file_size) {
}
static void act_pgdn(void) {
- int new_top;
+ fileoffset_t new_top;
cur_pos += (scrlines-1) * width;
if (cur_pos >= file_size) {
}
static void act_bottom (void) {
- int new_top;
+ fileoffset_t new_top;
cur_pos = file_size;
edit_type = !!edit_type;
}
static void act_cut (void) {
- long marktop, marksize;
+ fileoffset_t marktop, marksize;
if (!marking || mark_point==cur_pos) {
display_beep();
}
static void act_copy (void) {
- int marktop, marksize;
+ fileoffset_t marktop, marksize;
if (!marking) {
display_beep();
}
static void act_paste (void) {
- int cutsize, new_top;
+ fileoffset_t cutsize, new_top;
cutsize = buf_length (cutbuffer);
if (!insert_mode) {
static void act_goto (void) {
char buffer[80];
- long position, new_top;
+ fileoffset_t position, new_top;
int error;
if (!get_str("Enter position to go to: ", buffer, FALSE))
}
static void act_search (void) {
- int len, posn, dfapos;
+ int len;
+ fileoffset_t posn, dfapos;
DFA dfa;
static unsigned char sblk[SEARCH_BLK];
static char withdef[] = "Search forward (default=last): ";
posn++;
dfapos = dfa[dfapos][*q++];
if (dfapos == len) {
- int new_top;
+ fileoffset_t new_top;
cur_pos = posn - len;
edit_type = !!edit_type;
}
static void act_search_backwards (void) {
- int len, posn, dfapos;
+ int len;
+ fileoffset_t posn, dfapos;
DFA dfa;
static unsigned char sblk[SEARCH_BLK];
static char withdef[] = "Search backward (default=last): ";
posn--;
dfapos = dfa[dfapos][*--q];
if (dfapos == len) {
- int new_top;
+ fileoffset_t new_top;
cur_pos = posn;
edit_type = !!edit_type;
static void act_width (void) {
char buffer[80];
char prompt[80];
- long w;
- long new_top;
+ fileoffset_t w;
+ fileoffset_t new_top;
int error;
- sprintf (prompt, "Enter screen width in bytes (now %d): ", width);
+ sprintf (prompt, "Enter screen width in bytes (now %"OFF"d): ", width);
if (!get_str (prompt, buffer, FALSE))
return;
w = parse_num (buffer, &error);
static void act_offset (void) {
char buffer[80];
char prompt[80];
- long o;
- long new_top;
+ fileoffset_t o;
+ fileoffset_t new_top;
int error;
- sprintf (prompt, "Enter start-of-file offset in bytes (now %d): ",
+ sprintf (prompt, "Enter start-of-file offset in bytes (now %"OFF"d): ",
realoffset);
if (!get_str (prompt, buffer, FALSE))
return;