mirror of https://github.com/adamdruppe/arsd.git
sundry bugfixes
This commit is contained in:
parent
72ae4bd16d
commit
acabbf1c4a
4
color.d
4
color.d
|
@ -1208,7 +1208,7 @@ class TrueColorImageWithoutAlpha : MemoryImage {
|
|||
+/
|
||||
|
||||
|
||||
alias extern(C) int function(const void*, const void*) @system Comparator;
|
||||
alias extern(C) int function(scope const void*, scope const void*) @system Comparator;
|
||||
@trusted void nonPhobosSort(T)(T[] obj, Comparator comparator) {
|
||||
import core.stdc.stdlib;
|
||||
qsort(obj.ptr, obj.length, typeof(obj[0]).sizeof, comparator);
|
||||
|
@ -1240,7 +1240,7 @@ body {
|
|||
int opCmp(ref const ColorUse co) const {
|
||||
return co.uses - uses;
|
||||
}
|
||||
extern(C) static int comparator(const void* lhs, const void* rhs) {
|
||||
extern(C) static int comparator(scope const void* lhs, scope const void* rhs) {
|
||||
return (cast(ColorUse*)rhs).uses - (cast(ColorUse*)lhs).uses;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5217,7 +5217,7 @@ version(X11) {
|
|||
data[0 .. text.length] = text[];
|
||||
return data[0 .. text.length];
|
||||
} else {
|
||||
data[] = text[];
|
||||
data[] = text[0 .. data.length];
|
||||
text = text[data.length .. $];
|
||||
return data[];
|
||||
}
|
||||
|
@ -14432,6 +14432,7 @@ static if(!SdpyIsUsingIVGLBinds) {
|
|||
|
||||
Added: August 25, 2020 (version 8.5)
|
||||
+/
|
||||
version(without_opengl) {} else
|
||||
void glBufferDataSlice(GLenum target, const(void[]) data, GLenum usage) {
|
||||
glBufferData(target, data.length, data.ptr, usage);
|
||||
}
|
||||
|
@ -14493,6 +14494,7 @@ struct BasicMatrix(int columns, int rows, T = float) {
|
|||
|
||||
Added: August 25, 2020 (version 8.5)
|
||||
+/
|
||||
version(without_opengl) {} else
|
||||
final class OpenGlShader {
|
||||
private int shaderProgram_;
|
||||
private @property void shaderProgram(int a) {
|
||||
|
@ -15918,8 +15920,11 @@ private mixin template DynamicLoad(Iface, string library, bool openGLRelated = f
|
|||
libHandle = dlopen("/usr/X11/lib/lib" ~ library ~ ".dylib", RTLD_NOW);
|
||||
else
|
||||
libHandle = dlopen(library ~ ".dylib", RTLD_NOW);
|
||||
} else
|
||||
} else {
|
||||
libHandle = dlopen("lib" ~ library ~ ".so", RTLD_NOW);
|
||||
if(libHandle is null && library[0] == 'X') // some systems require the version number and we using X11R6 so just hardcoding special case.
|
||||
libHandle = dlopen("lib" ~ library ~ ".so.6", RTLD_NOW);
|
||||
}
|
||||
|
||||
static void* loadsym(void* l, const char* name) {
|
||||
import core.stdc.stdlib;
|
||||
|
|
|
@ -90,23 +90,34 @@ TerminalEmulator.TerminalCell[] sliceTrailingWhitespace(TerminalEmulator.Termina
|
|||
return t;
|
||||
}
|
||||
|
||||
struct ScopeBuffer(T, size_t maxSize) {
|
||||
T[maxSize] buffer;
|
||||
struct ScopeBuffer(T, size_t maxSize, bool allowGrowth = false) {
|
||||
T[maxSize] bufferInternal;
|
||||
T[] buffer;
|
||||
size_t length;
|
||||
bool isNull = true;
|
||||
T[] opSlice() { return isNull ? null : buffer[0 .. length]; }
|
||||
void opOpAssign(string op : "~")(in T rhs) {
|
||||
if(buffer is null) buffer = bufferInternal[];
|
||||
isNull = false;
|
||||
if(this.length < buffer.length) // i am silently discarding more crap
|
||||
static if(allowGrowth) {
|
||||
if(this.length == buffer.length)
|
||||
buffer.length = buffer.length * 2;
|
||||
|
||||
buffer[this.length++] = rhs;
|
||||
} else {
|
||||
if(this.length < buffer.length) // i am silently discarding more crap
|
||||
buffer[this.length++] = rhs;
|
||||
}
|
||||
}
|
||||
void opOpAssign(string op : "~")(in T[] rhs) {
|
||||
if(buffer is null) buffer = bufferInternal[];
|
||||
isNull = false;
|
||||
buffer[this.length .. this.length + rhs.length] = rhs[];
|
||||
this.length += rhs.length;
|
||||
}
|
||||
void opAssign(in T[] rhs) {
|
||||
isNull = rhs is null;
|
||||
if(buffer is null) buffer = bufferInternal[];
|
||||
buffer[0 .. rhs.length] = rhs[];
|
||||
this.length = rhs.length;
|
||||
}
|
||||
|
@ -999,7 +1010,7 @@ class TerminalEmulator {
|
|||
immutable(dchar[dchar])* characterSet = null; // null means use regular UTF-8
|
||||
|
||||
bool readingEsc = false;
|
||||
ScopeBuffer!(ubyte, 1024) esc;
|
||||
ScopeBuffer!(ubyte, 1024, true) esc;
|
||||
/// sends raw input data to the terminal as if the application printf()'d it or it echoed or whatever
|
||||
void sendRawInput(in ubyte[] datain) {
|
||||
const(ubyte)[] data = datain;
|
||||
|
@ -3707,20 +3718,24 @@ mixin template PtySupport(alias resizeHelper) {
|
|||
throw new Exception("WriteFile " ~ to!string(GetLastError()));
|
||||
} else version(Posix) {
|
||||
import core.sys.posix.unistd;
|
||||
int frozen;
|
||||
while(data.length) {
|
||||
enum MAX_SEND = 1024 * 20;
|
||||
auto sent = write(master, data.ptr, data.length > MAX_SEND ? MAX_SEND : cast(int) data.length);
|
||||
//import std.stdio; writeln("ROFL ", sent, " ", data.length);
|
||||
|
||||
import core.stdc.errno;
|
||||
/*
|
||||
if(sent == -1 && errno == 11) {
|
||||
import core.thread;
|
||||
Thread.sleep(100.msecs);
|
||||
if(frozen == 50)
|
||||
throw new Exception("write froze up");
|
||||
frozen++;
|
||||
Thread.sleep(10.msecs);
|
||||
//import std.stdio; writeln("lol");
|
||||
continue; // just try again
|
||||
}
|
||||
*/
|
||||
|
||||
frozen = 0;
|
||||
|
||||
import std.conv;
|
||||
if(sent < 0)
|
||||
|
|
Loading…
Reference in New Issue