Skip to content

Commit

Permalink
minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
mintty committed May 11, 2024
1 parent 1a750e5 commit e0133bc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ extern void win_save_title(void);
extern void win_restore_title(void);
extern void win_copy_title(void);
extern char * win_get_title(void);
extern void win_copy_text(const char *s);

/* colour */
extern colour win_get_colour(colour_i);
Expand Down Expand Up @@ -87,6 +86,7 @@ extern int win_char_width(xchar, cattrflags attr);
extern wchar win_combine_chars(wchar bc, wchar cc, cattrflags attr);

extern void win_open(wstring path, bool adjust_dir);
extern void win_copy_text(const char *s);
extern void win_copy(const wchar *data, cattr *cattrs, int len);
extern void win_copy_as(const wchar *data, cattr *cattrs, int len, char what);
extern void win_paste(void);
Expand Down
16 changes: 16 additions & 0 deletions src/winclip.c
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,22 @@ apply_attr_colour_rtf(cattr ca, attr_colour_mode mode, int * pfgi, int * pbgi)
return ca.attr;
}

void
win_copy_text(const char *s)
{
unsigned int size;
wchar *text = cs__mbstowcs(s);

if (text == NULL) {
return;
}
size = wcslen(text);
if (size > 0) {
win_copy(text, 0, size + 1);
}
free(text);
}

void
win_copy(const wchar *data, cattr *cattrs, int len)
{
Expand Down
16 changes: 0 additions & 16 deletions src/winmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,22 +1122,6 @@ win_get_title(void)
return cs__wcstombs(title);
}

void
win_copy_text(const char *s)
{
unsigned int size;
wchar *text = cs__mbstowcs(s);

if (text == NULL) {
return;
}
size = wcslen(text);
if (size > 0) {
win_copy(text, 0, size + 1);
}
free(text);
}

void
win_prefix_title(const wstring prefix)
{
Expand Down

0 comments on commit e0133bc

Please sign in to comment.