Lines Matching +full:ps +full:- +full:hold
1 // SPDX-License-Identifier: GPL-2.0
35 /* Don't take this from <ctype.h>: 011-015 on the screen aren't spaces */
48 .start = -1,
54 /* set reverse video on characters s-e of console with selection. */
57 invert_screen(vc_sel.cons, s, e-s+2, true); in highlight()
76 * clear_selection - remove current selection
79 * holding the selection. The caller must hold the console lock.
83 highlight_pointer(-1); /* hide the pointer */ in clear_selection()
84 if (vc_sel.start != -1) { in clear_selection()
86 vc_sel.start = -1; in clear_selection()
102 0x03FFE000, /* digits and "-./" */
113 * sel_loadlut() - load the LUT table
116 * Load the LUT table from user space. The caller must hold the console
123 return -EFAULT; in sel_loadlut()
134 /* stores the char in UTF8 and returns the number of bytes used (1-4) */
169 * set_selection_user - set the current selection.
184 return -EFAULT; in set_selection_user()
196 bp = kmalloc_array((vc_sel.end - vc_sel.start) / 2 + 1, unicode ? 4 : 1, in vc_selection_store_chars()
201 return -ENOMEM; in vc_selection_store_chars()
215 if (!((i + 2) % vc->vc_size_row)) { in vc_selection_store_chars()
217 unless non-space at end of line. */ in vc_selection_store_chars()
225 vc_sel.buf_len = bp - vc_sel.buffer; in vc_selection_store_chars()
230 static int vc_do_selection(struct vc_data *vc, unsigned short mode, int ps, in vc_do_selection() argument
237 case TIOCL_SELCHAR: /* character-by-character selection */ in vc_do_selection()
238 new_sel_start = ps; in vc_do_selection()
241 case TIOCL_SELWORD: /* word-by-word selection */ in vc_do_selection()
242 spc = is_space_on_vt(sel_pos(ps, unicode)); in vc_do_selection()
243 for (new_sel_start = ps; ; ps -= 2) { in vc_do_selection()
244 if ((spc && !is_space_on_vt(sel_pos(ps, unicode))) || in vc_do_selection()
245 (!spc && !inword(sel_pos(ps, unicode)))) in vc_do_selection()
247 new_sel_start = ps; in vc_do_selection()
248 if (!(ps % vc->vc_size_row)) in vc_do_selection()
258 if (!((pe + 2) % vc->vc_size_row)) in vc_do_selection()
262 case TIOCL_SELLINE: /* line-by-line selection */ in vc_do_selection()
263 new_sel_start = rounddown(ps, vc->vc_size_row); in vc_do_selection()
264 new_sel_end = rounddown(pe, vc->vc_size_row) + in vc_do_selection()
265 vc->vc_size_row - 2; in vc_do_selection()
271 return -EINVAL; in vc_do_selection()
275 highlight_pointer(-1); in vc_do_selection()
279 !atedge(new_sel_end, vc->vc_size_row) && in vc_do_selection()
283 atedge(pe, vc->vc_size_row)) in vc_do_selection()
288 if (vc_sel.start == -1) /* no current selection */ in vc_do_selection()
302 highlight(new_sel_start, vc_sel.start - 2); in vc_do_selection()
304 highlight(vc_sel.start, new_sel_start - 2); in vc_do_selection()
320 int ps, pe; in vc_selection() local
324 if (v->sel_mode == TIOCL_SELCLEAR) { in vc_selection()
330 v->xs = min_t(u16, v->xs - 1, vc->vc_cols - 1); in vc_selection()
331 v->ys = min_t(u16, v->ys - 1, vc->vc_rows - 1); in vc_selection()
332 v->xe = min_t(u16, v->xe - 1, vc->vc_cols - 1); in vc_selection()
333 v->ye = min_t(u16, v->ye - 1, vc->vc_rows - 1); in vc_selection()
335 if (mouse_reporting() && (v->sel_mode & TIOCL_SELMOUSEREPORT)) { in vc_selection()
336 mouse_report(tty, v->sel_mode & TIOCL_SELBUTTONMASK, v->xs, in vc_selection()
337 v->ys); in vc_selection()
341 ps = v->ys * vc->vc_size_row + (v->xs << 1); in vc_selection()
342 pe = v->ye * vc->vc_size_row + (v->xe << 1); in vc_selection()
343 if (ps > pe) /* make vc_sel.start <= vc_sel.end */ in vc_selection()
344 swap(ps, pe); in vc_selection()
351 return vc_do_selection(vc, v->sel_mode, ps, pe); in vc_selection()
377 struct vc_data *vc = tty->driver_data; in paste_selection()
390 return -EIO; /* ldisc was hung up */ in paste_selection()
391 tty_buffer_lock_exclusive(&vc->port); in paste_selection()
393 add_wait_queue(&vc->paste_wait, &wait); in paste_selection()
398 ret = -EINTR; in paste_selection()
408 count = vc_sel.buf_len - pasted; in paste_selection()
414 remove_wait_queue(&vc->paste_wait, &wait); in paste_selection()
417 tty_buffer_unlock_exclusive(&vc->port); in paste_selection()