"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "button.c" between
xterm-364.tgz and xterm-365.tgz

About: xterm is a terminal emulator for X with ISO/ANSI color and vt220 enhancements.

button.c  (xterm-364.tgz):button.c  (xterm-365.tgz)
/* $XTermId: button.c,v 1.630 2021/01/23 00:14:49 tom Exp $ */ /* $XTermId: button.c,v 1.631 2021/02/04 01:00:26 tom Exp $ */
/* /*
* Copyright 1999-2020,2021 by Thomas E. Dickey * Copyright 1999-2020,2021 by Thomas E. Dickey
* *
* All Rights Reserved * All Rights Reserved
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the * copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including * "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, * without limitation the rights to use, copy, modify, merge, publish,
skipping to change at line 164 skipping to change at line 164
static Time lastButtonDownTime = 0; static Time lastButtonDownTime = 0;
static int ExtendingSelection = 0; static int ExtendingSelection = 0;
static Time lastButton3UpTime = 0; static Time lastButton3UpTime = 0;
static Time lastButton3DoubleDownTime = 0; static Time lastButton3DoubleDownTime = 0;
static CELL lastButton3; /* At the release time */ static CELL lastButton3; /* At the release time */
#endif /* OPT_READLINE */ #endif /* OPT_READLINE */
static Char *SaveText(TScreen *screen, int row, int scol, int ecol, static Char *SaveText(TScreen *screen, int row, int scol, int ecol,
Char *lp, int *eol); Char *lp, int *eol);
static int Length(TScreen *screen, int row, int scol, int ecol); static int Length(TScreen *screen, int row, int scol, int ecol);
static void ComputeSelect(XtermWidget xw, CELL *startc, CELL *endc, Bool extend) static void ComputeSelect(XtermWidget xw, CELL *startc, CELL *endc, Bool
; extend, Bool normal);
static void EditorButton(XtermWidget xw, XButtonEvent *event); static void EditorButton(XtermWidget xw, XButtonEvent *event);
static void EndExtend(XtermWidget w, XEvent *event, String *params, Cardinal static void EndExtend(XtermWidget w, XEvent *event, String *params, Cardinal
num_params, Bool use_cursor_loc); num_params, Bool use_cursor_loc);
static void ExtendExtend(XtermWidget xw, const CELL *cell); static void ExtendExtend(XtermWidget xw, const CELL *cell);
static void PointToCELL(TScreen *screen, int y, int x, CELL *cell); static void PointToCELL(TScreen *screen, int y, int x, CELL *cell);
static void ReHiliteText(XtermWidget xw, CELL *first, CELL *last); static void ReHiliteText(XtermWidget xw, CELL *first, CELL *last);
static void SaltTextAway(XtermWidget xw, int which, CELL *cellc, CELL *cell); static void SaltTextAway(XtermWidget xw, int which, CELL *cellc, CELL *cell);
static void SelectSet(XtermWidget xw, XEvent *event, String *params, Cardinal nu m_params); static void SelectSet(XtermWidget xw, XEvent *event, String *params, Cardinal nu m_params);
static void SelectionReceived PROTO_XT_SEL_CB_ARGS; static void SelectionReceived PROTO_XT_SEL_CB_ARGS;
static void StartSelect(XtermWidget xw, const CELL *cell); static void StartSelect(XtermWidget xw, const CELL *cell);
skipping to change at line 2986 skipping to change at line 2987
/* else use old values in rawPos */ /* else use old values in rawPos */
screen->saveStartR = screen->startExt = screen->rawPos; screen->saveStartR = screen->startExt = screen->rawPos;
screen->saveEndR = screen->endExt = screen->rawPos; screen->saveEndR = screen->endExt = screen->rawPos;
if (Coordinate(screen, cell) < Coordinate(screen, &(screen->rawPos))) { if (Coordinate(screen, cell) < Coordinate(screen, &(screen->rawPos))) {
screen->eventMode = LEFTEXTENSION; screen->eventMode = LEFTEXTENSION;
screen->startExt = *cell; screen->startExt = *cell;
} else { } else {
screen->eventMode = RIGHTEXTENSION; screen->eventMode = RIGHTEXTENSION;
screen->endExt = *cell; screen->endExt = *cell;
} }
ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False); ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False, True);
} }
static void static void
EndExtend(XtermWidget xw, EndExtend(XtermWidget xw,
XEvent *event, /* must be XButtonEvent */ XEvent *event, /* must be XButtonEvent */
String *params, /* selections */ String *params, /* selections */
Cardinal num_params, Cardinal num_params,
Bool use_cursor_loc) Bool use_cursor_loc)
{ {
CELL cell; CELL cell;
skipping to change at line 3191 skipping to change at line 3192
< Abs(coord - Coordinate(screen, &(screen->endSel))) < Abs(coord - Coordinate(screen, &(screen->endSel)))
|| coord < Coordinate(screen, &(screen->startSel))) { || coord < Coordinate(screen, &(screen->startSel))) {
/* point is close to left side of selection */ /* point is close to left side of selection */
screen->eventMode = LEFTEXTENSION; screen->eventMode = LEFTEXTENSION;
screen->startExt = cell; screen->startExt = cell;
} else { } else {
/* point is close to left side of selection */ /* point is close to left side of selection */
screen->eventMode = RIGHTEXTENSION; screen->eventMode = RIGHTEXTENSION;
screen->endExt = cell; screen->endExt = cell;
} }
ComputeSelect(xw, &(screen->startExt), &(screen->endExt), True); ComputeSelect(xw, &(screen->startExt), &(screen->endExt), True, True);
#if OPT_READLINE #if OPT_READLINE
if (!isSameCELL(&(screen->startSel), &(screen->endSel))) if (!isSameCELL(&(screen->startSel), &(screen->endSel)))
ExtendingSelection = 1; ExtendingSelection = 1;
#endif #endif
} }
static void static void
ExtendExtend(XtermWidget xw, const CELL *cell) ExtendExtend(XtermWidget xw, const CELL *cell)
{ {
skipping to change at line 3223 skipping to change at line 3224
&& coord < Coordinate(screen, &(screen->startSel))) { && coord < Coordinate(screen, &(screen->startSel))) {
/* Whoops, he's changed his mind. Do LEFTEXTENSION */ /* Whoops, he's changed his mind. Do LEFTEXTENSION */
screen->eventMode = LEFTEXTENSION; screen->eventMode = LEFTEXTENSION;
screen->endExt = screen->saveEndR; screen->endExt = screen->saveEndR;
} }
if (screen->eventMode == LEFTEXTENSION) { if (screen->eventMode == LEFTEXTENSION) {
screen->startExt = *cell; screen->startExt = *cell;
} else { } else {
screen->endExt = *cell; screen->endExt = *cell;
} }
ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False); ComputeSelect(xw, &(screen->startExt), &(screen->endExt), False, True);
#if OPT_READLINE #if OPT_READLINE
if (!isSameCELL(&(screen->startSel), &(screen->endSel))) if (!isSameCELL(&(screen->startSel), &(screen->endSel)))
ExtendingSelection = 1; ExtendingSelection = 1;
#endif #endif
} }
void void
HandleStartExtend(Widget w, HandleStartExtend(Widget w,
XEvent *event, /* must be XButtonEvent* */ XEvent *event, /* must be XButtonEvent* */
skipping to change at line 4004 skipping to change at line 4005
&& LineTstWrapped(ltmp)) && LineTstWrapped(ltmp))
/* /*
* sets startSel endSel * sets startSel endSel
* ensuring that they have legal values * ensuring that they have legal values
*/ */
static void static void
ComputeSelect(XtermWidget xw, ComputeSelect(XtermWidget xw,
CELL *startc, CELL *startc,
CELL *endc, CELL *endc,
Bool extend) Bool extend,
Bool normal)
{ {
TScreen *screen = TScreenOf(xw); TScreen *screen = TScreenOf(xw);
int cclass; int cclass;
CELL first = *startc; CELL first = *startc;
CELL last = *endc; CELL last = *endc;
Boolean ignored = False; Boolean ignored = False;
struct { struct {
LineData *startSel; LineData *startSel;
skipping to change at line 4074 skipping to change at line 4076
do { do {
mark = screen->startSel; mark = screen->startSel;
--screen->startSel.col; --screen->startSel.col;
if (screen->startSel.col < 0 if (screen->startSel.col < 0
&& isPrevWrapped(startSel)) { && isPrevWrapped(startSel)) {
PrevRow(startSel); PrevRow(startSel);
screen->startSel.col = LastTextCol(screen, ld.startSel, scree n->startSel.row); screen->startSel.col = LastTextCol(screen, ld.startSel, scree n->startSel.row);
} }
} while (screen->startSel.col >= 0 } while (screen->startSel.col >= 0
&& CClassSelects(startSel, cclass)); && CClassSelects(startSel, cclass));
screen->startSel = mark; if (normal)
++screen->startSel.col;
else
screen->startSel = mark;
} }
#if OPT_WIDE_CHARS #if OPT_WIDE_CHARS
#define SkipHiddenCell(mark) \ #define SkipHiddenCell(mark) \
if (mark.col && XTERM_CELL(mark.row, mark.col) == HIDDEN_CHAR) \ if (mark.col && XTERM_CELL(mark.row, mark.col) == HIDDEN_CHAR) \
mark.col++ mark.col++
#else #else
#define SkipHiddenCell(mark) /* nothing */ #define SkipHiddenCell(mark) /* nothing */
#endif #endif
SkipHiddenCell(screen->startSel); SkipHiddenCell(screen->startSel);
screen->endSel = screen->startSel; if (!normal) {
ld.endSel = ld.startSel; screen->endSel = screen->startSel;
ld.endSel = ld.startSel;
}
if (okPosition(screen, &(ld.endSel), &(screen->endSel))) { if (okPosition(screen, &(ld.endSel), &(screen->endSel))) {
int length = LastTextCol(screen, ld.endSel, screen->endSel.row); int length = LastTextCol(screen, ld.endSel, screen->endSel.row);
cclass = CClassOf(endSel); cclass = CClassOf(endSel);
TRACE(("...ending with class %d\n", cclass)); TRACE(("...ending with class %d\n", cclass));
do { do {
++screen->endSel.col; ++screen->endSel.col;
if (screen->endSel.col > length if (screen->endSel.col > length
&& LineTstWrapped(ld.endSel)) { && LineTstWrapped(ld.endSel)) {
if (!MoreRows(endSel)) if (!MoreRows(endSel))
break; break;
screen->endSel.col = 0; screen->endSel.col = 0;
NextRow(endSel); NextRow(endSel);
length = LastTextCol(screen, ld.endSel, screen->endSel.row); length = LastTextCol(screen, ld.endSel, screen->endSel.row);
} }
} while (screen->endSel.col <= length } while (screen->endSel.col <= length
&& CClassSelects(endSel, cclass)); && CClassSelects(endSel, cclass));
if (normal
&& screen->endSel.col > length + 1
&& MoreRows(endSel)) {
screen->endSel.col = 0;
NextRow(endSel);
}
} }
SkipHiddenCell(screen->endSel); SkipHiddenCell(screen->endSel);
screen->saveStartW = screen->startSel; screen->saveStartW = screen->startSel;
break; break;
case Select_LINE: case Select_LINE:
TRACE(("Select_LINE\n")); TRACE(("Select_LINE\n"));
while (LineTstWrapped(ld.endSel) while (LineTstWrapped(ld.endSel)
&& MoreRows(endSel)) { && MoreRows(endSel)) {
skipping to change at line 5564 skipping to change at line 5577
start->col = cell.col; start->col = cell.col;
finish->row = cell.row; finish->row = cell.row;
finish->col = screen->max_col; finish->col = screen->max_col;
} else { } else {
start->row = screen->cur_row; start->row = screen->cur_row;
start->col = screen->cur_col; start->col = screen->cur_col;
finish->row = screen->cur_row; finish->row = screen->cur_row;
finish->col = screen->max_col; finish->col = screen->max_col;
} }
ComputeSelect(xw, start, finish, False); ComputeSelect(xw, start, finish, False, False);
SaltTextAway(xw, SaltTextAway(xw,
TargetToSelection(screen, PRIMARY_NAME), TargetToSelection(screen, PRIMARY_NAME),
&(screen->startSel), &(screen->endSel)); &(screen->startSel), &(screen->endSel));
if (scp->data_limit && scp->data_buffer) { if (scp->data_limit && scp->data_buffer) {
TRACE(("...getDataFromScreen selection-data %.*s\n", TRACE(("...getDataFromScreen selection-data %.*s\n",
(int) scp->data_limit, (int) scp->data_limit,
scp->data_buffer)); scp->data_buffer));
result = malloc(scp->data_limit + 1); result = malloc(scp->data_limit + 1);
if (result) { if (result) {
 End of changes. 10 change blocks. 
11 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)