mirror of https://github.com/adamdruppe/arsd.git
merge conflict fix
This commit is contained in:
commit
af47ae19c2
6
jsvar.d
6
jsvar.d
|
@ -1086,8 +1086,8 @@ struct var {
|
|||
}
|
||||
|
||||
public ref var opIndex(string name, string file = __FILE__, size_t line = __LINE__) {
|
||||
// if name is numeric, we should convert to int
|
||||
if(name.length && name[0] >= '0' && name[0] <= '9')
|
||||
// if name is numeric, we should convert to int for arrays
|
||||
if(name.length && name[0] >= '0' && name[0] <= '9' && this.payloadType() == Type.Array)
|
||||
return opIndex(to!size_t(name), file, line);
|
||||
|
||||
if(this.payloadType() != Type.Object && name == "prototype")
|
||||
|
@ -1162,7 +1162,7 @@ struct var {
|
|||
}
|
||||
|
||||
public ref var opIndexAssign(T)(T t, string name, string file = __FILE__, size_t line = __LINE__) {
|
||||
if(name.appearsNumeric()) {
|
||||
if(this.payloadType == Type.Array && name.appearsNumeric()) {
|
||||
try {
|
||||
auto i = to!size_t(name);
|
||||
return opIndexAssign(t, i, file, line);
|
||||
|
|
27
minigui.d
27
minigui.d
|
@ -7,6 +7,7 @@
|
|||
// add note about manifest to documentation. also icons.
|
||||
|
||||
// a pager control is just a horizontal scroll area just with arrows on the sides instead of a scroll bar
|
||||
// FIXME: clear the corner of scrollbars if they pop up
|
||||
|
||||
// minigui needs to have a stdout redirection for gui mode on windows writeln
|
||||
|
||||
|
@ -14,6 +15,8 @@
|
|||
|
||||
// need a viewer widget that works like a web page - arrows scroll down consistently
|
||||
|
||||
// I want a nanovega widget, and a svg widget with some kind of event handlers attached to the inside.
|
||||
|
||||
// FIXME: the menus should be a bit more discoverable, at least a single click to open the others instead of two.
|
||||
// and help info about menu items.
|
||||
// and search in menus?
|
||||
|
@ -55,7 +58,7 @@
|
|||
on Windows and does its own thing on Linux (Mac is not currently supported but
|
||||
may be later, and should use native controls) to keep size down. The Linux
|
||||
appearance is similar to Windows 95 and avoids using images to maintain network
|
||||
efficiency on remote X connections.
|
||||
efficiency on remote X connections, though you can customize that.
|
||||
|
||||
minigui's only required dependencies are [arsd.simpledisplay] and [arsd.color].
|
||||
|
||||
|
@ -2032,7 +2035,7 @@ class ScrollableWidget : Widget {
|
|||
///
|
||||
void verticalScrollTo(int pos) {
|
||||
scrollOrigin_.y = pos;
|
||||
if(scrollOrigin_.y + viewportHeight > contentHeight)
|
||||
if(pos == int.max || (scrollOrigin_.y + viewportHeight > contentHeight))
|
||||
scrollOrigin_.y = contentHeight - viewportHeight;
|
||||
|
||||
if(scrollOrigin_.y < 0)
|
||||
|
@ -2058,7 +2061,7 @@ class ScrollableWidget : Widget {
|
|||
///
|
||||
void horizontalScrollTo(int pos) {
|
||||
scrollOrigin_.x = pos;
|
||||
if(scrollOrigin_.x + viewportWidth > contentWidth)
|
||||
if(pos == int.max || (scrollOrigin_.x + viewportWidth > contentWidth))
|
||||
scrollOrigin_.x = contentWidth - viewportWidth;
|
||||
|
||||
if(scrollOrigin_.x < 0)
|
||||
|
@ -5570,8 +5573,22 @@ abstract class EditableTextWidget : EditableTextWidgetParent {
|
|||
auto cbb = textLayout.contentBoundingBox();
|
||||
setContentSize(cbb.width, cbb.height);
|
||||
|
||||
} else
|
||||
content = content ~ txt;
|
||||
} else version(win32_widgets) {
|
||||
// get the current selection
|
||||
DWORD StartPos, EndPos;
|
||||
SendMessageW( hwnd, EM_GETSEL, cast(WPARAM)(&StartPos), cast(WPARAM)(&EndPos) );
|
||||
|
||||
// move the caret to the end of the text
|
||||
int outLength = GetWindowTextLengthW( hwndOutput );
|
||||
SendMessageW( hwnd, EM_SETSEL, outLength, outLength );
|
||||
|
||||
// insert the text at the new caret position
|
||||
WCharzBuffer bfr = WCharzBuffer(txt, WindowsStringConversionFlags.convertNewLines);
|
||||
SendMessageW( hwnd, EM_REPLACESEL, TRUE, txt );
|
||||
|
||||
// restore the previous selection
|
||||
SendMessageW( hwnd, EM_SETSEL, StartPos, EndPos );
|
||||
} else static assert(0);
|
||||
}
|
||||
|
||||
version(custom_widgets)
|
||||
|
|
|
@ -979,6 +979,14 @@ version(FreeBSD)
|
|||
version(Solaris)
|
||||
version = X11;
|
||||
|
||||
|
||||
void featureNotImplemented()() {
|
||||
version(allow_unimplemented_features)
|
||||
throw new NotYetImplementedException();
|
||||
else
|
||||
static assert(0);
|
||||
}
|
||||
|
||||
// these are so the static asserts don't trigger unless you want to
|
||||
// add support to it for an OS
|
||||
version(Windows)
|
||||
|
@ -1163,7 +1171,7 @@ TrueColorImage trueColorImageFromNativeHandle(NativeWindowHandle handle, int wid
|
|||
} else version(Windows) {
|
||||
// I just need to BitBlt that shit... BUT WAIT IT IS ALREADY IN A DIB!!!!!!!
|
||||
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1303,7 +1311,7 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
|||
display = XDisplayConnection.get(); // get initial display to not segfault
|
||||
} else version(OSXCocoa)
|
||||
throw new NotYetImplementedException();
|
||||
else static assert(0);
|
||||
else featureNotImplemented();
|
||||
// FIXME: set the size correctly
|
||||
_width = 1;
|
||||
_height = 1;
|
||||
|
@ -1989,7 +1997,7 @@ class SimpleWindow : CapableOfHandlingNativeEvent, CapableOfBeingDrawnUpon {
|
|||
} else version(Windows) {
|
||||
impl.currentCursor = ch;
|
||||
SetCursor(ch); // redraw without waiting for mouse movement to update
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2577,7 +2585,7 @@ static struct GenericCursor {
|
|||
case GenericCursorType.SizeWe: osId = 108 /* XC_sb_h_double_arrow */; break;
|
||||
}
|
||||
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
|
||||
mc = new MouseCursor(osId);
|
||||
}
|
||||
|
@ -3975,7 +3983,7 @@ class Timer {
|
|||
ev.data.fd = fd;
|
||||
ep.epoll_ctl(epollFd, ep.EPOLL_CTL_ADD, fd, &ev);
|
||||
}
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
}
|
||||
|
||||
/// Stop and destroy the timer object.
|
||||
|
@ -4007,7 +4015,7 @@ class Timer {
|
|||
mapping.remove(fd);
|
||||
fd = -1;
|
||||
}
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
}
|
||||
|
||||
~this() {
|
||||
|
@ -4041,7 +4049,7 @@ class Timer {
|
|||
unix.read(fd, &val, val.sizeof); // gotta clear the pipe
|
||||
} else version(Windows) {
|
||||
|
||||
} else static assert(0);
|
||||
} else featureNotImplemented();
|
||||
|
||||
onPulse();
|
||||
}
|
||||
|
@ -13605,6 +13613,9 @@ mixin template ExperimentalTextComponent() {
|
|||
if(selectionStart is selectionEnd)
|
||||
return; // no selection
|
||||
|
||||
if(selectionStart.inlineElement is null) return;
|
||||
if(selectionEnd.inlineElement is null) return;
|
||||
|
||||
assert(selectionStart.inlineElement !is null);
|
||||
assert(selectionEnd.inlineElement !is null);
|
||||
|
||||
|
@ -13809,6 +13820,9 @@ mixin template ExperimentalTextComponent() {
|
|||
if(selectionStart is selectionEnd)
|
||||
return;
|
||||
|
||||
if(selectionStart.inlineElement is null) return;
|
||||
if(selectionEnd.inlineElement is null) return;
|
||||
|
||||
assert(selectionStart.inlineElement !is null);
|
||||
assert(selectionEnd.inlineElement !is null);
|
||||
|
||||
|
@ -14081,7 +14095,7 @@ enum _NET_WM_STATE_ADD = 1;
|
|||
enum _NET_WM_STATE_REMOVE = 0;
|
||||
enum _NET_WM_STATE_TOGGLE = 2;
|
||||
|
||||
/// X-specific
|
||||
/// X-specific. Use [SimpleWindow.requestAttention] instead for most casesl
|
||||
void demandAttention(SimpleWindow window, bool needs = true) {
|
||||
auto display = XDisplayConnection.get();
|
||||
auto atom = XInternAtom(display, "_NET_WM_STATE_DEMANDS_ATTENTION", true);
|
||||
|
|
Loading…
Reference in New Issue