This is a Nexus 7 spd hub gear twist shifter integrated in the brake lever. I had to undo the gear cable to get my rear wheel out. I therefore turned the bicycle upside down (some say that this alone can wreck this type of shifter). I reinstalled the cable on the hub, but ever since the shifter won't work. I re-undid the gear cable at the hub end and now nothing seems to work anymore: arbitrary amount of cable length that I can pull out at the hub end (but never enough to reinstall the gear cable on the hub) and arbitrary amount of positions I can click the shifter in, no matter what I do (gear cable adjustement bolt completely in or out etc....). Is this shifter broken or am I missing something?
Looks like the barrel adjuster has been broken off and has floated down the shift cable, so the shifter end of the cable housing is not anchored.
The shifter unit should look like this
You might be able to glue the inner barrel back on to the shifter body. The housing is pulled back into the shifter so the glued joint would be compressed rather than pulled apart.
The problem is the amount of exposed inner cable - the outer should be hard against the shifter, with the (broken) barrel adjuster used for fine tuning. If you slide the outer up to the shifter you should be able to get enough at the hub end o attach it. From here you may be able to get the bike usable, but with the broken barrel adjuster you wont be able to fine tune the gear shifts.
The broken barrel adjuster needs replacing, which means removing the full inner cable. Normally this means a new inner is needed as any frayed end won't easily be able to slide back into the housing. (You can waste hours trying save the couple of dollars a new inner costs)
In case there are more problems than described above, I would got though the process of getting the shifter working (even if roughly) with the existing cable and housing, then deal with the broken barrel adjuster.