Support text selection across the board
This commit is contained in:
parent
98b33b9a82
commit
62d3af3c1e
2 changed files with 22 additions and 22 deletions
6
KEYS
6
KEYS
|
@ -111,8 +111,10 @@ ctrl-g,esc - cancel
|
|||
[1] i'm somewhat mouse button confused, since i use "left handed" mouse
|
||||
while not being lefthanded
|
||||
|
||||
[2] text selection requires xsel
|
||||
http://www.vergenet.net/~conrad/software/xsel/
|
||||
[2] text selection requires
|
||||
xsel on X11 - http://www.vergenet.net/~conrad/software/xsel/
|
||||
wsel under Windows - http://repo.or.cz/w/llpp.git/blob/master:/wsel.c
|
||||
pbcopy under OSX - ships with the system
|
||||
|
||||
[3] if the document was previously visited initial backspace will
|
||||
jump to the last visited place
|
||||
|
|
38
link.c
38
link.c
|
@ -202,8 +202,12 @@ struct page {
|
|||
void (*freepage) (void *);
|
||||
};
|
||||
|
||||
#if !defined __APPLE__
|
||||
#define USE_XSEL
|
||||
#if defined __APPLE__
|
||||
#define SELCMD "pbcopy"
|
||||
#elif defined _WIN32 || defined __CYGWIN__
|
||||
#define SELCMD "wsel"
|
||||
#else
|
||||
#define SELCMD "xsel -i"
|
||||
#endif
|
||||
|
||||
struct {
|
||||
|
@ -253,7 +257,7 @@ struct {
|
|||
#else
|
||||
pthread_t thread;
|
||||
#endif
|
||||
FILE *xselpipe;
|
||||
FILE *selpipe;
|
||||
|
||||
FT_Face face;
|
||||
|
||||
|
@ -2217,18 +2221,14 @@ CAMLprim value ml_copysel (value ptr_v)
|
|||
|
||||
if (!*s) {
|
||||
close:
|
||||
#ifdef USE_XSEL
|
||||
if (state.xselpipe) {
|
||||
int ret = pclose (state.xselpipe);
|
||||
if (state.selpipe) {
|
||||
int ret = pclose (state.selpipe);
|
||||
if (ret == -1) {
|
||||
fprintf (stderr, "failed to close xsel pipe: %s\n",
|
||||
fprintf (stderr, "failed to close sel pipe: %s\n",
|
||||
strerror (errno));
|
||||
}
|
||||
state.xselpipe = NULL;
|
||||
state.selpipe = NULL;
|
||||
}
|
||||
#else
|
||||
printf ("========================================\n");
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
fz_text_span *span;
|
||||
|
@ -2241,21 +2241,19 @@ CAMLprim value ml_copysel (value ptr_v)
|
|||
}
|
||||
|
||||
f = stdout;
|
||||
#ifdef USE_XSEL
|
||||
if (!state.xselpipe) {
|
||||
state.xselpipe = popen ("xsel -i", "w");
|
||||
if (!state.xselpipe) {
|
||||
fprintf (stderr, "failed to open xsel pipe: %s\n",
|
||||
if (!state.selpipe) {
|
||||
state.selpipe = popen (SELCMD, "w");
|
||||
if (!state.selpipe) {
|
||||
fprintf (stderr, "failed to open sel pipe: %s\n",
|
||||
strerror (errno));
|
||||
}
|
||||
else {
|
||||
f = state.xselpipe;
|
||||
f = state.selpipe;
|
||||
}
|
||||
}
|
||||
else {
|
||||
f = state.xselpipe;
|
||||
f = state.selpipe;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (span = page->fmark.span;
|
||||
span && span != page->lmark.span->next;
|
||||
|
@ -2267,7 +2265,7 @@ CAMLprim value ml_copysel (value ptr_v)
|
|||
}
|
||||
if (span->eol) {
|
||||
if (putc ('\n', f) == EOF) {
|
||||
fprintf (stderr, "failed break line on xsel pipe: %s\n",
|
||||
fprintf (stderr, "failed break line on sel pipe: %s\n",
|
||||
strerror (errno));
|
||||
goto close;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue